Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Double buffering in java

  • 27-05-2002 07:24PM
    #1
    Posts: 431 ✭✭


    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, Registered Users 2, Paid Member Posts: 2,032 ✭✭✭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: 431 ✭✭ [Deleted User]


    cheers thanks for that!
    :D


  • Registered Users, Registered Users 2 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