Example usage for javax.swing RepaintManager setDoubleBufferingEnabled

List of usage examples for javax.swing RepaintManager setDoubleBufferingEnabled

Introduction

In this page you can find the example usage for javax.swing RepaintManager setDoubleBufferingEnabled.

Prototype

public void setDoubleBufferingEnabled(boolean aFlag) 

Source Link

Document

Enables or disables double buffering in this RepaintManager.

Usage

From source file:DebugGraphicsDemo.java

public static void main(String[] a) {

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JButton bn = new JButton();

    RepaintManager repaintManager = RepaintManager.currentManager(bn);
    repaintManager.setDoubleBufferingEnabled(false);

    bn.setDebugGraphicsOptions(/* w  ww  .j a v a2 s. co m*/
            DebugGraphics.BUFFERED_OPTION | DebugGraphics.FLASH_OPTION | DebugGraphics.LOG_OPTION);

    frame.add(bn);

    frame.setSize(300, 300);
    frame.setVisible(true);

    frame.add(bn);
}

From source file:Main.java

public static void enableDoubleBuffering(Component c) {
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(true);
}

From source file:Main.java

public static void disableDoubleBuffering(Component c) {
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(false);
}

From source file:Main.java

/**
 * Disable double buffering.//from  w  w w .ja  v  a  2 s. c  o m
 *
 * @param c
 *            the c
 */
public static void disableDoubleBuffering(final Component c) {
    final RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(false);
}

From source file:com.alvermont.terraj.util.io.PrintUtilities.java

/**
 * Disable double buffering for a component
 * /*  www  .j a  v  a2  s  .  co m*/
 * @param c The component to disable double buffering for
 */
public static void disableDoubleBuffering(Component c) {
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(false);
}

From source file:com.alvermont.terraj.util.io.PrintUtilities.java

/**
 * Enable double buffering for a component
 * //w w w  .  ja  va2  s .  co  m
 * @param c The component to enable double buffering for
 */
public static void enableDoubleBuffering(Component c) {
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(true);
}

From source file:SoundManagerTest.java

/**
 * Installs the NullRepaintManager./* www . j a  v  a 2 s.  co m*/
 */
public static void install() {
    RepaintManager repaintManager = new NullRepaintManager();
    repaintManager.setDoubleBufferingEnabled(false);
    RepaintManager.setCurrentManager(repaintManager);
}

From source file:MyJava3D.java

/**
 * It's possible to turn off double-buffering for just the repaint calls
 * invoked directly on the non double buffered component. This can be done
 * by overriding paintImmediately() (which is called as a result of repaint)
 * and getting the current RepaintManager and turning off double buffering
 * in the RepaintManager before calling super.paintImmediately(g).
 *//*from   w ww.  j  a v  a 2s .c  o m*/
public void paintImmediately(int x, int y, int w, int h) {
    RepaintManager repaintManager = null;
    boolean save = true;
    if (!isDoubleBuffered()) {
        repaintManager = RepaintManager.currentManager(this);
        save = repaintManager.isDoubleBufferingEnabled();
        repaintManager.setDoubleBufferingEnabled(false);
    }
    super.paintImmediately(x, y, w, h);

    if (repaintManager != null) {
        repaintManager.setDoubleBufferingEnabled(save);
    }
}