How to double-buffer a JWindow?

Hi,
I made a resizable JWindow, but whenever I resize, J-components within the window flicker. (First setSize(), then validate() to redraw for correct sizes). I know JWindow is not double buffered, I want to override the paint() method to implement double buffering -- anyone knows how to do that? (...besides copying from JComponent.java)

I think double buffering available in Swing with out you doing anything. Just add the following line to your window initialization.
((JPanel)window.getContentPane()).setDoubleBuffered(true);If this doesn't work, and I think it should. Then use the code below.
This is code copied from http://java.sun.com/j2se/1.3/docs/guide/awt/designspec/lightweights.html
The following is a Panel, but you can apply the same logic to JWindow.
public class DoubleBufferPanel extends Panel {   
  Image offscreen;
   * null out the offscreen buffer as part of invalidation
  public void invalidate() {
      super.invalidate();
      offscreen = null;
   * override update to *not* erase the background before painting
  public void update(Graphics g) {
      paint(g);
   * paint children into an offscreen buffer, then blast entire image
   * at once.
  public void paint(Graphics g) {
      if(offscreen == null) {
         offscreen = createImage(getSize().width, getSize().height);
      Graphics og = offscreen.getGraphics();
      og.setClip(0,0,getSize().width, getSize().height);
      super.paint(og);
      g.drawImage(offscreen, 0, 0, null);
      og.dispose();

Similar Messages

  • What is the best way to double buffer in this case and how to do it....

    currently I have
    public class Frame1 extends JFrame{
    //inside this class I call up circle class, rectangle class, etc.... to draw
    }I am making a "paint" program, and I have individual classes to handle the paint methods heres an example:
    abstract public class Shape {
        public Shape() {
        public abstract void draw(Graphics g, Color c, int x, int y, int width,int height);
    }and then....
    public class Circle extends Shape{
        public Circle() {
        public void draw(Graphics g, Color c, int oldx, int oldy, int newx, int newy) {
            g.setColor(c);
            g.drawOval(Math.min(oldx, newx), Math.min(oldy, newy), Math.abs(oldx - newx), Math.abs(oldy - newy));
    }There is also a Rectangle class, line class.... etc! So my question to you is the following... what is the best way to implement double buffer in the individual classes? And how to do it?? And also.... the drawings should be kept inside a jPanel.
    Any bit of help is much appreciated Thank you!!

    You don't need to do double-buffering. Swing
    components are double-buffered by default. Just make
    sure you override paintComponent() and not paint().
    And even if you had to, why would there be any
    difference in implementation for your classes whether
    they paint to on- or off-screen graphics?I need to override paintComponent()? what if I don't...
    I am using JBuilder2005 and they automate somethings for me. So thats how they did it when they created the application they did this....
    public class Frame1 extends JFrame{
    /*** all my code here***/
    public class Application1 {
        boolean packFrame = false;
         * Construct and show the application.
        public Application1() {
            Frame1 frame = new Frame1();
            // Validate frames that have preset sizes
            // Pack frames that have useful preferred size info, e.g. from their layout
            if (packFrame) {
                frame.pack();
            } else {
                frame.validate();
            // Center the window
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            Dimension frameSize = frame.getSize();
            if (frameSize.height > screenSize.height) {
                frameSize.height = screenSize.height;
            if (frameSize.width > screenSize.width) {
                frameSize.width = screenSize.width;
            frame.setLocation((screenSize.width - frameSize.width) / 2,
                              (screenSize.height - frameSize.height) / 2);
            frame.setVisible(true);
            try {
                jbInit();
            } catch (Exception ex) {
                ex.printStackTrace();
         * Application entry point.
         * @param args String[]
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    try {
                        UIManager.setLookAndFeel(UIManager.
                                                 getSystemLookAndFeelClassName());
                    } catch (Exception exception) {
                        exception.printStackTrace();
                    new Application1();
        private void jbInit() throws Exception {
    }

  • Double Buffer

    Hi all,
    I've just written this Digital Clock in Java and I'm trying to add a double buffer to it to stop it flickering however I get 4 errors when I try to compile it. Here is the code:
    (START OF CODE)
         import java.awt.*; //puts in abstract windows toolkit to get output on screen
         import java.util.*;
         import java.applet.Applet;
         import java.awt.event.*;
         //<applet code="DigitalClock.class" width=400 height=400></applet> //displays applet without needing to create HTML file
         public class DigitalClock extends Applet implements ActionListener, Runnable //listen for action events
         Image myimage,buffer;
         Graphics doublebuffer;
         private javax.swing.Timer timer; //implements timer
         public void init() {
    timer = new javax.swing.Timer(1000, this);
    timer.setInitialDelay(0);
    timer.start();
         buffer = createImage(width,height);
         doublebuffer = buffer.getGraphics();
         public void paint(Graphics g) //states that the code below will paint objects onto the applet
         g.setColor (Color.white); //sets colour to white
         g.drawRect(130, 78, 120, 30); //rectangle shape surrounding digital clock
         g.setColor (Color.darkGray); //sets colour to grey
         g.fillRect(132, 80, 117, 27); //fills rectangle from code 2 lines up with colour grey
         setBackground(Color.black); //specifies background colour as black
         Calendar myCal = new GregorianCalendar();
         myCal.set(1956, Calendar.MARCH, 17); //
         of myCal.setTime(myCal2.getTime());
         myCal.setTime(new Date());
         int year = myCal.get(Calendar.YEAR); int mnth = myCal.get(Calendar.MONTH) + 1;
         int DATE = myCal.get(Calendar.DATE); System.out.println(DATE + "." + mnth + "." + year);
         myCal.add(Calendar.YEAR, 1);
         DATE myDate = myCal.getTime(); System.out.println(myDate);
         GregorianCalendar cal = new GregorianCalendar(); //tells program to implement the a new Gregorian Calemder in order to display a date or time
         doublebuffer.setFont(new Font("Arial", Font.BOLD,20)); //sets font to arial, bold style, and size 20
         doublebuffer.setColor (Color.white); //sets colour to white
    doublebuffer.drawString(cal.get(Calendar.HOUR_OF_DAY) + " : " + //examines windows clock to get current hour
    cal.get(Calendar.MINUTE) + " : " + //examines windows clock to get current minute
    cal.get(Calendar.SECOND), 140, 100); //examines windows clock to get current second
         doublebuffer.setFont(new Font("Arial", Font.BOLD,15)); //sets the font to arial, bold style, and size 15
         doublebuffer.drawString("By Darren Cole", 130, 270); //adds words in pink as string and specifies coardinates
         doublebuffer.drawString("Last Modified: 03/04/03", 110, 290); //adds words in pink as string and specifies coardinates
         doublebuffer.drawLine(90, 60, 130, 77); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(210, 60, 250, 77); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 60, 210, 60); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 90, 130, 107); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 60, 90, 90); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.setColor (Color.darkGray); //sets colour to dark grey
         doublebuffer.fillRect(129, 62, 83, 16);
         g.drawImage(buffer,0,0,this);
         public void actionPerformed(ActionEvent e) //tells program that there is an action event specified in the code below
         repaint(); //keeps repainting the digital clock graphics as the time changes i.e. keeps looping the code over
    (END OF CODE)
    What am I doing wrong here? Also I've tried to implement the date as well using a GregorianCalendar. How would I actually make the date appear on the page?
    Thanks,
    Darren

    Most of that doesn't matter now because I've now put in a simplercode for the date but it still doesn't display. But now I get 10 errors. The new code is:
    (START OF CODE)
    import java.awt.*; //puts in abstract windows toolkit to get output on screen
         import java.util.*;
         import java.applet.Applet;
         import java.awt.event.*;
         //<applet code="DigitalClock.class" width=400 height=400></applet> //displays applet without needing to create HTML file
         public class DigitalClock extends Applet implements ActionListener, Runnable //listen for action events
         Graphics doublebuffer;
         private javax.swing.Timer timer; //implements timer
         public void init() {
    timer = new javax.swing.Timer(1000, this);
    timer.setInitialDelay(0);
    timer.start();
         doublebuffer = buffer.getGraphics();
         public void paint(Graphics g) //states that the code below will paint objects onto the applet
         doublebuffer.setColor (Color.white); //sets colour to white
         doublebuffer.drawRect(130, 78, 120, 30); //rectangle shape surrounding digital clock
         doublebuffer.setColor (Color.darkGray); //sets colour to grey
         doublebuffer.fillRect(132, 80, 117, 27); //fills rectangle from code 2 lines up with colour grey
         setBackground(Color.black); //specifies background colour as black
         Calendar date = new GregorianCalendar();
         DateFormat df=DateFormat.getDateInstance(DateFormat.LONG);
         String date = df.format(new Date());
         GregorianCalendar cal = new GregorianCalendar(); //tells program to implement the a new Gregorian Calemder in order to display a date or time
         doublebuffer.setFont(new Font("Arial", Font.BOLD,20)); //sets font to arial, bold style, and size 20
         doublebuffer.setColor (Color.white); //sets colour to white
    doublebuffer.drawString(cal.get(Calendar.HOUR_OF_DAY) + " : " + //examines windows clock to get current hour
    cal.get(Calendar.MINUTE) + " : " + //examines windows clock to get current minute
    cal.get(Calendar.SECOND), 140, 100); //examines windows clock to get current second
         doublebuffer.setFont(new Font("Arial", Font.BOLD,15)); //sets the font to arial, bold style, and size 15
         doublebuffer.drawString("By Darren Cole", 130, 270); //adds words in pink as string and specifies coardinates
         doublebuffer.drawString("Last Modified: 03/04/03", 110, 290); //adds words in pink as string and specifies coardinates
         doublebuffer.drawLine(90, 60, 130, 77); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(210, 60, 250, 77); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 60, 210, 60); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 90, 130, 107); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 60, 90, 90); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.setColor (Color.darkGray); //sets colour to dark grey
         doublebuffer.fillRect(129, 62, 83, 16);
         g.drawImage(buffer,0,0,this);
         public void actionPerformed(ActionEvent e) //tells program that there is an action event specified in the code below
         repaint(); //keeps repainting the digital clock graphics as the time changes i.e. keeps looping the code over
    (END OF CODE)
    The errors are:
    ---------- Javac ----------
    DigitalClock.java:63: 'class' or 'interface' expected
         public void actionPerformed(ActionEvent e) //tells program that there is an action event specified in the code below
    ^
    DigitalClock.java:70: 'class' or 'interface' expected
    ^
    DigitalClock.java:70: 'class' or 'interface' expected
    ^
    DigitalClock.java:8: DigitalClock should be declared abstract; it does not define run() in DigitalClock
         public class DigitalClock extends Applet implements ActionListener, Runnable //listen for action events
    ^
    DigitalClock.java:21: cannot resolve symbol
    symbol : variable buffer
    location: class DigitalClock
         doublebuffer = buffer.getGraphics();
    ^
    DigitalClock.java:37: cannot resolve symbol
    symbol : class DateFormat
    location: class DigitalClock
         DateFormat df=DateFormat.getDateInstance(DateFormat.LONG);
    ^
    DigitalClock.java:37: cannot resolve symbol
    symbol : variable DateFormat
    location: class DigitalClock
         DateFormat df=DateFormat.getDateInstance(DateFormat.LONG);
    ^
    DigitalClock.java:37: cannot resolve symbol
    symbol : variable DateFormat
    location: class DigitalClock
         DateFormat df=DateFormat.getDateInstance(DateFormat.LONG);
    ^
    DigitalClock.java:38: date is already defined in paint(java.awt.Graphics)
         String date = df.format(new Date());
    ^
    DigitalClock.java:58: cannot resolve symbol
    symbol : variable buffer
    location: class DigitalClock
         g.drawImage(buffer,0,0,this);
    ^
    10 errors
    Normal Termination
    Output completed (2 sec consumed).
    Thanks,
    Darren

  • Enabling Double-buffer in JPanel

    Does anyone know how i would enable the double-buffering that JPanel supports. I have heard that it supports that and you have to enable it. If anyone could help i would really appreciate it thanks.
    mdawg

    From the JDK1.2.2 API:
    Constructor Summary
    JPanel()
    Create a new JPanel with a double buffer and a flow layout
    JPanel(boolean isDoubleBuffered)
    Create a new JPanel with FlowLayout and the specified buffering strategy.
    JPanel(LayoutManager layout)
    Create a new buffered JPanel with the specified layout manager
    JPanel(LayoutManager layout, boolean isDoubleBuffered)
    Creates a new JPanel with the specified layout manager and buffering strategy.
    It would appear that double buffering is the default.

  • Swing & double buffer

    Hello
    My English abillity is very poor ... sorry
    as I know Swing offer double buffer very easy and default
    I check My application is offer double buffer (I check use isDoublebuffered())
    and I draw my pic in JPanel
    paint(Graphics g){
    and I make update method
    update (Grphaics g){
    paint(g);
    but my application flash and flicker...
    How can I solve my problem?
    What I do solve my problem?
    plz help
    have a nice day

    paint(Graphics g){
    and I make update method
    update (Grphaics g){
    paint(g);
    }1. JComponent already has method update overridden to call paint -- you shouldn't override update.
    2. Don't override paint, override paintComponent instead, usually like this:
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        //do your painting here:
    }3. Swing components double buffer by default. You shouldn't have to use BufferedImages just to avoid flicker. Try to reduce your problem to a minimal example and post it.

  • Double Buffer program is slowing down, help.

    Hello, I have a small Dancing Lines program like an old Windows screensaver program and it appears to slow down after about 30 seconds to a minute. I "clear" my buffer by copying a screen sized black symbol to the buffer. If anyone has any ideas about how to make this more efficient and most importantly stop the slow down, please let me know, thanks.
    // Variables
    var x0:int;
    var y0:int;
    var x1:int;
    var y1:int;
    var x2:int;
    var y2:int;
    var x3:int;
    var y3:int;
    var dx0:int;
    var dy0:int;
    var dx1:int;
    var dy1:int;
    var dx2:int;
    var dy2:int;
    var dx3:int;
    var dy3:int;
    var counter:int = 0;
    var clearBuffer:Buffer = new Buffer();
    var drawing:Shape = new Shape();
    var color1:uint = uint(0xFFFFFF * Math.random());
    // Initialize Line Values
    x0 = int(Math.random() * 320);
    x1 = int(Math.random() * 320);
    y0 = int(Math.random() * 200);
    y1 = int(Math.random() * 200);
    x2 = x0;
    x3 = x1;
    y2 = y0;
    y3 = y1;
    // Initializing Line Velocities
    dx0 = int(Math.random() * 5);
    dx1 = int(Math.random() * 5);
    dy0 = int(Math.random() * 5);
    dy1 = int(Math.random() * 5);
    dx2 = dx0;
    dx3 = dx1;
    dy2 = dy0;
    dy3 = dy1;
    // Double Buffer Setup
    var bitmap:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,true,0xff000000);                          
    var buffer:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,true,0xff000000);
    var image:Bitmap = new Bitmap(bitmap);
    addChild(image);
    // Listeners
    addEventListener(Event.ENTER_FRAME,onEnterFrame);
    function onEnterFrame(event:Event):void {
         // Clear The Sreen
         buffer.draw(clearBuffer);
         // Logic
         drawing.graphics.lineStyle(1, color1);
         drawing.graphics.moveTo(x0,y0);
         drawing.graphics.lineTo(x1,y1);
         if ((x0 += dx0) >= 315 || x0 < 5)
              dx0 *= -1;
         if ((y0 += dy0) >= 195 || y0 < 5)
              dy0 *= -1;
         if ((x1 += dx1) >= 315 || x1 < 5)
              dx1 *= -1;
         if ((y1 += dy1) >= 195 || y1 < 5)
              dy1 *= -1;
         if (++counter > 50) {
              drawing.graphics.lineStyle(1, 0x000000);
              drawing.graphics.moveTo(x2,y2);
              drawing.graphics.lineTo(x3,y3);
              if ((x2 += dx2) >= 315 || x2 < 5)
                   dx2 *= -1;
              if ((y2 += dy2) >= 195 || y2 < 5)
                   dy2 *= -1;
              if ((x3 += dx3) >= 315 || x3 < 5)
                   dx3 *= -1;
              if ((y3 += dy3) >= 195 || y3 < 5)
                   dy3 *= -1;
         if (counter > 250)
              counter = 51;
         // Draw The Screen
         buffer.draw(drawing, drawing.transform.matrix);
         bitmap.draw(buffer);
    P.S. - Is there a way I can post my code in a smaller box with a scrollbar?

    Here is a fixed version:
    // Variables
    var x0:int;
    var y0:int;
    var x1:int;
    var y1:int;
    var x2:int;
    var y2:int;
    var x3:int;
    var y3:int;
    var dx0:int;
    var dy0:int;
    var dx1:int;
    var dy1:int;
    var dx2:int;
    var dy2:int;
    var dx3:int;
    var dy3:int;
    var counter:int = 0;
    var drawing:Shape = new Shape();
    var color1:uint = uint(0xFFFFFF * Math.random());
    // Initialize Line Values
    x0 = int(Math.random() * 320);
    x1 = int(Math.random() * 320);
    y0 = int(Math.random() * 200);
    y1 = int(Math.random() * 200);
    x2 = x0;
    x3 = x1;
    y2 = y0;
    y3 = y1;
    // Initializing Line Velocities
    dx0 = int(Math.random() * 5);
    dx1 = int(Math.random() * 5);
    dy0 = int(Math.random() * 5);
    dy1 = int(Math.random() * 5);
    dx2 = dx0;
    dx3 = dx1;
    dy2 = dy0;
    dy3 = dy1;
    // Double Buffer Setup
    var bitmap:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,true,0xff000000);                         
    var buffer:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,true,0xff000000);
    var image:Bitmap = new Bitmap(bitmap);
    addChild(image);
    // Listeners
    addEventListener(Event.ENTER_FRAME,onEnterFrame);
    function onEnterFrame(event:Event):void {
         // Logic
         drawing.graphics.lineStyle(1, color1);
         drawing.graphics.moveTo(x0,y0);
         drawing.graphics.lineTo(x1,y1);
         if ((x0 += dx0) >= 315 || x0 < 5)
              dx0 *= -1;
         if ((y0 += dy0) >= 195 || y0 < 5)
              dy0 *= -1;
         if ((x1 += dx1) >= 315 || x1 < 5)
              dx1 *= -1;
         if ((y1 += dy1) >= 195 || y1 < 5)
              dy1 *= -1;
         if (++counter > 50) {
              drawing.graphics.lineStyle(1, 0x000000);
              drawing.graphics.moveTo(x2,y2);
              drawing.graphics.lineTo(x3,y3);
              if ((x2 += dx2) >= 315 || x2 < 5)
                   dx2 *= -1;
              if ((y2 += dy2) >= 195 || y2 < 5)
                   dy2 *= -1;
              if ((x3 += dx3) >= 315 || x3 < 5)
                   dx3 *= -1;
              if ((y3 += dy3) >= 195 || y3 < 5)
                   dy3 *= -1;
         // Draw The Screen
         buffer.draw(drawing, drawing.transform.matrix);
         bitmap.draw(buffer);
         // clear drawing canvas
         drawing.graphics.clear();
    Basically you have to use the graphics.clear() function to erase any clip where you are using the drawing API. Drawing lots of vectors can be very costly performance-wise so you always want to clear your graphics when you are finished. Drawing over the vectors with a rectangle has no effect except to increase the load even more. However when dealing with bitmap objects you can safely draw as much as you want for as long as you wish with no performance hit. Thats why what you were trying to do with that "clearBuffer" was not doing anything. Also, setting the counter to 51 when it got to 250 was doing nothing whatsoever. Not sure what that was for. The code should work fine now.

  • How to reduce buffer busy waits, session hanging due to buffer busy waits

    Hi,
    How to reduce buffer busy waits, session hanging due to buffer busy waits.
    Thanks,
    Sathis.

    When I see through enterprise manager I see lot of
    tables with buffer busy waits.
    Is there any way by table name we can check the
    blocks info.
    The simple way is to look at the SQL statement and corresponding table name?
    P1=file#, P2=block#. You can extract segment name(table or index) using this info.
    Query v$bh like following:
    SQL> select file#, block#, class#, objd from v$bh where file# = P1 and block# = P2;
    SQL> select object_name from all_objects where object_id = <objd>;See following doc:
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_1051.htm
    Or you can dump block:
    SQL> alter system dump datafie <P1> block <P2>;Some excerpts from block dump:
    scn: 0x07df.17e70782 seq: 0x01 flg: 0x04 tail: 0x07822301
    frmt: 0x02 chkval: 0x61d0 type: 0x23=PAGETABLE SEGMENT HEADER
    Map Header:: next  0x00000000  #extents: 1    obj#: 55881  flag: 0x10000000>
    Can we do something at table level that will reduce
    the waits.
    Yes, some methods are known. But before thinking of that, you must verify which block class and which access are involved.
    Typo... always. :(
    Message was edited by:
    Dion_Cho

  • How to double space in Pages for iPad?

    How to double space in Pages for iPad?

    Double spacing is double spacing whether you are using Pages or Word. Double spacing is dependent upon the font size that you are using in the document no matter which word processing app that you use.
    Pages on the iPad has limited fonts and chances are pretty good that if you import a Word file into Pages on the iPad, there will be some formatting or font issues.
    But once again, Helvetica in Pages is pretty much the same Helvetica as you would be using in Word. If you use a font in Word that is not available in Pages, you will see a warning message that some elements of the original document have been changed.

  • How to caluculate buffer size for import/exports in oracle

    Hi DBAS,
    how to caluculate buffer size for import exports,here is the formula but how can we use if there is a 100 of tables and datatypes,is the any query to find out rows_in_array ,maximum_row_size total schema and datbase
    buffer_size = rows_in_array maximum_row_size*
    Thanks,
    tmadugula

    http://download.oracle.com/docs/cd/B10501_01/server.920/a96652/ch01.htm
    Search "buffer"

  • How to calculate #Buffer Gets    # Exec           Buffer Gets/Exec

    Hi,
    How to calculate #Buffer Gets,# Execution time,Buffer Gets/Exec for a sql query?

    Nirmal
    You can find out these statistics from two places
    1) using SQL_TRACE (10046 trace) and then TKPROF (or Autotrace in SQL*Plus)
    2) or looking at V$SQL which records the cost assigned to each SQL statement since the statement was first cached.
    If you use Statspack or AWR, you can see the difference between two points in time, so you can calculate the cost for a period of time.
    See Using SQL_Trace and TKPROF
    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96533/sqltrace.htm#1018
    and Using Statspack
    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96533/statspac.htm#34837
    (see the 10g documentation equivalents if necessary).
    Remember, ratios (eg gets/exec) aren't always very helpful. You're best off concentrating on those operations which take longest (ie where there is the most potential to save time). See (eg) www.hotsos.com, www.oraperf.com, and others to identify effective performance methodologies.
    HTH
    Regards Nigel

  • How to double space words in pages

    I want to know how to double space WORDS NOT LINES on pages

    I only see lines :(
    You can turn off the period shortcut, so you can double space yourself easier. In settings, general, keyboard, "." Shortcut OFF. It's a work around.

  • How to understand buffer swaps

    In SAP training materials, it says that buffer swaps occur when buffer content is deleted from the buffer and is replaced by other content. It's no relation at all to the swapping mechanism on OS level.
    I am confused about the source and target of buffer swaps. For example, when buffer swaps occur on program buffer(PXA), where will the data in program buffer be put, physical memory?, and where does new data come from? SAP buffers locate on share memory, belong to virtual memory, but virtual memory is the summary of physical memory and OS swap space(or OS paging file). I just remember that extended memory resides on physical memory, don't know whether sap buffers reside on physical too.
    For swapping on OS level, I think it's page exchange between physical memory and swap space which locates on disk. Is it right?
    Please advise on how to understand buffer swaps and OS swapping. Thanks so much.
    James

    Hi James,
    Plz find the link  I hope it might help you,
    http://help.sap.com/saphelp_nw70/helpdata/EN/c4/3a6dbb505211d189550000e829fbbd/frameset.htm
    as the question you have asked is concentrating in
    depth and this can be understood if you have a look
    at the following link.
    regards,
    Manjula.

  • Need to output 8 channels using double buffer

    Hi,
    I need to ouput 8 channels to the DAQ card.
    I am getting an array 8 bytes of data every 10 milliseconds.
    Each byte corresponds to a channel.
    I am using your WFMDoubleBuffer.c code.
    The changes I have made are :
    1. Changed the buffer from 32K to 16 bytes. I am assuming 8 bytes with double buffer = 16 bytes
    2. I'm not sure about updateRate, so I set it to 1.0
    Result : I get an error from WFM_Group_Control(). It says "The operation could not complete within the time limit", error = -10800
    I have attached the file for your reference.
    Please help me.
    Thanking you in anticipation
    Chandra
    Attachments:
    WFMdoubleBuf.C ‏8 KB

    Chandra,
    The timeout error here is slightly misleading. The reason this is happening is caused by a few things. By default, the card to setup to transfer data when the onboard FIFO is full, and so your half buffer must be the same size or large than your FIFO unless you have regeneration turned on. Regeneration will cause your buffer to be copied as many times as possible into the FIFO until it is full. Your 6713 has an AO FIFO size of 16,384. So your buffer size must be twice this, so that your half buffer is >= 16384. Where is your data coming from at these 10 ms intervals, from a program or another device? This could affect what method would be the best solution.
    If you want to keep working on this, let�s stick to one channel, I sent you an email, did you get
    it?
    Kevin R
    Applications Engineer
    National Instruments

  • Double buffer for different components.

    Currently I'm working on a project where I have a JPanel inside of a JFrame. The panel takes up a portion of the frame and on other side I have a JButton and two JTextfields. My double buffer method works fine for the JPanel but every time it's repainted the other components in my JFrame look like they need to be buffered. What would be the best way to fix this? I think I just need to re-add the other components whenever the Panel is repainted but I run into a lot of problems if that's the case.

    We can't see your code so we'll take your word for it. But if I use Swing components they typically don't 'need buffering' by which I assume you mean that they flicker? So the problem is when you combine your code with Swing so you'll have to debug that yourself or show some code (preferrably as SSCCE).

  • How do i double buffer this code (URGENT)

    i make an image move when user presses the arrow buttons but the moving image flickers how do i prevent that
    the code:
    import java.awt.*;
    import java.io.*;
    public class KenshinGame extends Frame{
    MoveImages mi = new MoveImages();
    int x = 355;
    int y = 10;
    int spaceCount = 0;
    public KenshinGame () {
         add ("Center", mi);
    public boolean handleEvent (Event evt){
         if (evt.id == Event.WINDOW_DESTROY){
         System.exit(0);
         return super.handleEvent(evt);
    public boolean keyDown(Event evt, int key){
    if (key == Event.LEFT) {
         //System.out.println (x);
         if (y > 125 && y <170 && x > 65){
         x = x - 10;
         mi.move(x, y);
         else if (y < 650&& y > 620 && x > 110){
         x = x - 10;
         mi.move(x, y);
    else if (key == Event.RIGHT) {
         //System.out.println (x);
         if (y > 125 && y <170 && x < 675){
         x = x + 10;
         mi.move(x, y);
         else if (y < 650&& y > 620 && x < 640){
         x = x + 10;
         mi.move(x, y);
    else if (key == Event.UP) {
         //System.out.println (y);
         if (y > 10 && x == 355){
         y = y - 10;
         mi.move(x, y);
         else if (y > 120 && x > 320 && x < 390){
         y = y - 10;
         mi.move(x, y);
         else if (x < 130 && x > 110 && y > 120 && y < 170){
         y = y - 10;
         mi.move(x, y);
         else if (x > 475 && x < 515 && y > 110 && y < 170){
         y = y - 10;
         mi.move(x, y);
         else if (x > 625 && x < 655 && y > 110 && y < 170){
         y = y - 10;
         mi.move(x, y);
         else if (x < 130 && x > 110 && y > 605 && y < 640){
         y = y - 10;
         mi.move(x, y);
    else if (key == Event.DOWN) {
         if (x > 320 && x < 390 && y < 670){
         y = y + 10;
         mi.move(x, y);
         else if (x < 130 && x > 110 && y > 100 && y < 170){
         y = y + 10;
         mi.move(x, y);
         else if (x > 475 && x < 515 && y > 90 && y < 170){
         y = y + 10;
         mi.move(x, y);
         else if (x > 625 && x < 655 && y > 90 && y < 170){
         y = y + 10;
         mi.move(x, y);
         else if (x < 130 && x > 110 && y > 595 && y < 640){
         y = y + 10;
         mi.move(x, y);
         else if (y > 660){
         x = 615;
         y = 390;
         mi.move (x, y);
    return true;
    public static void main(String args[]) {
         Frame f = new KenshinGame();
         f.resize (760, 740);
         f.show();
         f.setTitle ("Gmae: Level 1");
    class MoveImages extends Canvas {
    int x = 355;
    int y = 10;
    int w = 10;
    int h = 20;
    String mapLoc = new String ("c:\\My Documents\\My Pictures\\liotto.gif");
    String maincLoc = new String ("c:\\My Documents\\My Pictures\\rstand.gif");
    Image map = Toolkit.getDefaultToolkit().getImage(mapLoc);
    Image mainc = Toolkit.getDefaultToolkit().getImage (maincLoc);
    public void paint (Graphics g){
         MediaTracker tracker = new MediaTracker(this);
         tracker.addImage(map, 0);
         g.drawImage (map, 0, 0, this);
         try {     
         tracker.waitForAll();
         catch (InterruptedException e) {
         g.drawImage (mainc, x, y, this);
    public void move(int xCo, int yCo){
         x = xCo;
         y = yCo;
         repaint();
    public void update (Graphics g){
         paint (g);
    }

    i havent changed the main class but i did change the canvas because i have figured out how to use double buffering any suggestions how i can fix this instead:
    class MoveImages extends Canvas {
    int x = 355;
    int y = 10;
    String di = "stand";
    String mapLoc = new String ("c:\\My Documents\\My Pictures\\liotto.gif");
    Image map = Toolkit.getDefaultToolkit().getImage(mapLoc);
    Image stand = Toolkit.getDefaultToolkit().getImage("c:\\My Documents\\My Pictures\\rstand.gif");
    Image walka = Toolkit.getDefaultToolkit().getImage("c:\\My Documents\\My Pictures\\rwalka.gif");
    Image walkt = Toolkit.getDefaultToolkit().getImage("c:\\My Documents\\My Pictures\\rwalkt.gif");
    Image walkl = Toolkit.getDefaultToolkit().getImage("c:\\My Documents\\My Pictures\\rwalkl.gif");
    Image walkr = Toolkit.getDefaultToolkit().getImage("c:\\My Documents\\My Pictures\\rwalkr.gif");
    int w = 760;
    int h = 740;
    Image offscreen ;
    Graphics og;
    public MoveImages (){
    public void paint (Graphics g){
         g.drawImage (map, 0, 0, this);
         if (di.equals ("stand")){
         g.drawImage (walka, x, y, this);
         g.drawImage (walkt, x, y, this);
         g.drawImage (walkl, x, y, this);
         g.drawImage (walkr, x, y, this);
         g.drawImage (stand, x, y, this);
         else if (di.equals ("walka")){
         g.drawImage (walkt, x, y, this);
         g.drawImage (walkl, x, y, this);
         g.drawImage (walkr, x, y, this);
         g.drawImage (stand, x, y, this);
         g.drawImage (walka, x, y, this);
         else if (di.equals ("walkt")){
         g.drawImage (walkl, x, y, this);
         g.drawImage (walkr, x, y, this);
         g.drawImage (stand, x, y, this);
         g.drawImage (walka, x, y, this);
         g.drawImage (walkt, x, y, this);
         else if (di.equals ("walkl")){
         g.drawImage (walkt, x, y, this);
         g.drawImage (walkr, x, y, this);
         g.drawImage (stand, x, y, this);
         g.drawImage (walka, x, y, this);
         g.drawImage (walkl, x, y, this);
         else if (di.equals ("walkr")){
         g.drawImage (walkt, x, y, this);
         g.drawImage (walkl, x, y, this);
         g.drawImage (stand, x, y, this);
         g.drawImage (walka, x, y, this);
         g.drawImage (walkr, x, y, this);
    public void move(int xCo, int yCo, String direction){
         di = direction;
         x = xCo;
         y = yCo;
         repaint();
    public void addNotify(){
         super.addNotify();
    public void update (Graphics g){
         if (offscreen == null){
         offscreen = createImage (w, h);
    og = offscreen.getGraphics ();
         paint (og);
         g.drawImage (offscreen, 0, 0, this);
    }

Maybe you are looking for

  • Made a UD to 'Scrap'. But Stock Category is "Q" and does not show in MMBE "Blocked"..WHY?

    Hi, I made a UD of an Insp Lot to 'Scrap' in the Inspection lot stock tab. The system automatically created a material document with movement type 553 (Direction -) and 551 (Direction +) However the stock Category in the material document is "Q". IS

  • Error in alert monitoring

    hello experts what is this error ??would you please tell me how to rectify below issue, ALERT for DX1EUR \ DX1_100_Business Process Engine \ Definition \ Event linkage propertie YELLOW CCMS alert for monitored object Event linkage properties Alert Te

  • Smartforms subtotals printing

    Friends, I am printing page wise subtotals in the PO layout i desinged.  My PO is a multiple page PO where i have two pages in my PO.  I am printing the PAGE WISE SUBTOTALS and then on the last page printing SUBTOTAL and FINAL TOTAL. If line items ar

  • IBook G4 with lid closed

    I have an iBook G4 with external keyboard and mouse. The help screen says if I put the iBook to sleep and close the lid, I can hit any key and my external Monitor will wake-up. Unfortunately it wakes up for just a second and goes right beack to sleep

  • Oracle 9i: Internet Directory Administrator's

    Hi, We are planning to replace TNSNAMES:ora in our computers using a OID server in order to connect to our Oracle 9i Standard Edition (9.2.0.7) . My question is the following. The OID is included in the Standard version? In the Enterprise version? Is