Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Double buffering in java

Options
  • 27-05-2002 7:24pm
    #1
    Posts: 0


    Can anyone tell me if double buffering is already implemented in java 2 or do we still have to do it ourselves?

    I thought i read somewhere that it was automatically used in the java graphics api?

    Any clarification would be great, thanks/


Comments

  • Registered Users Posts: 1,994 ✭✭✭lynchie


    public void setDoubleBuffered(boolean aFlag)

    Set whether the receiving component should use a buffer to paint. If set to true, all the drawing from this component will be done in an offscreen painting buffer. The offscreen painting buffer will the be copied onto the screen. Swing's painting system always use a maximum of one double buffer. If a Component is buffered and one of its ancestor is also buffered, the ancestor buffer will be used.

    This method is in JComponent, so all the of the swing components have the method available. Setting this to true will cause all painting to be done via a buffer. AFAIK this is set to true by default. You can check it by creating a JButton and calling isDoubleBuffered() on it straight away. It should be set to true by default. If you are not using swing you may have to implement double-buffering yourself


  • Posts: 0 [Deleted User]


    cheers thanks for that!
    :D


  • Registered Users Posts: 2,281 ✭✭✭DeadBankClerk


    Originally posted by lynchie
    This method is in JComponent, so all the of the swing components have the method available. Setting this to true will cause all painting to be done via a buffer. AFAIK this is set to true by default. You can check it by creating a JButton and calling isDoubleBuffered() on it straight away. It should be set to true by default. If you are not using swing you may have to implement double-buffering yourself

    I used to have a class called DB Applet or something that allowed you to double buffer vannilla pre-swing java (applets). You simply inherited from this class instead of Applet

    www.netsoc.tcd.ie/~dbc/java


Advertisement