Example usage for javax.swing RepaintManager currentManager

List of usage examples for javax.swing RepaintManager currentManager

Introduction

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

Prototype

public static RepaintManager currentManager(JComponent c) 

Source Link

Document

Return the RepaintManager for the calling thread given a JComponent.

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(/*from  ww w  .j av a  2  s.  c  om*/
            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 main(String[] args) {
    String imageFile = "A.jpg";
    RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);
    Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile));
    image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_SMOOTH);
    JFrame frame = new JFrame("DragImage");
    frame.getContentPane().add(new Main(image));
    frame.setSize(300, 300);// w w w .j a v a  2  s.  co  m
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    String imageFile = "A.jpg";
    RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);
    Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile));
    image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_DEFAULT);
    JFrame frame = new JFrame("DragImage");
    frame.getContentPane().add(new Main(image));
    frame.setSize(300, 300);/* w  w w .j  a  va 2  s  .c  o  m*/
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    String imageFile = "A.jpg";
    RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);
    Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile));
    image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_FAST);
    JFrame frame = new JFrame("DragImage");
    frame.getContentPane().add(new Main(image));
    frame.setSize(300, 300);/*from   w  ww.  j  a  v a 2s.  co  m*/
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    String imageFile = "A.jpg";
    RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);
    Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile));
    image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_AREA_AVERAGING);
    JFrame frame = new JFrame("DragImage");
    frame.getContentPane().add(new Main(image));
    frame.setSize(300, 300);/*from w  w  w  . j  a va 2  s  .com*/
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:DragImage.java

public static void main(String[] args) {
    String imageFile = "A.jpg";
    // Turn off double buffering
    RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);

    Image image = Toolkit.getDefaultToolkit().getImage(DragImage.class.getResource(imageFile));
    image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_DEFAULT);
    JFrame frame = new JFrame("DragImage");
    frame.getContentPane().add(new DragImage(image));
    frame.setSize(300, 300);//  w ww  .j  av  a 2  s . c  o m
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

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.j  a 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
 * //from  w  w w .j  av  a  2  s.c o  m
 * @param c The component to disable double buffering for
 */
public static void disableDoubleBuffering(Component c) {
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(false);
}