Java Code Examples for javax.swing.JPanel.setDoubleBuffered()

The following are Jave code examples for showing how to use setDoubleBuffered() of the javax.swing.JPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ramus   File: FilePlugin.java   View Source Code Vote up 6 votes
private void open() {
    JPanel contentPane = new JPanel();
    contentPane.setDoubleBuffered(true);
    JFileChooser chooser = new JFileChooser();
    chooser.setFileFilter(fileFilter);
    if (FilePlugin.this.getFile() == null) {
        String file = Options.getString(LAST_FILE);
        if (file != null) {
            chooser.setSelectedFile(new File(file));
        }
    } else
        chooser.setSelectedFile(FilePlugin.this.getFile());
    int r = chooser.showOpenDialog(framework.getMainFrame());
    if (r == JFileChooser.APPROVE_OPTION) {
        File f = chooser.getSelectedFile();
        loadFile(f);

    }

}
 
Example 2
Project: propan-jogl-examples   File: Example.java   View Source Code Vote up 5 votes
public static JComponent createComponent() {
	JPanel panel = new JPanel(new BorderLayout());
	panel.setDoubleBuffered(false);

	panel.add(new JButton("Press me!"), BorderLayout.NORTH);

	JProgressBar bar = new JProgressBar() {
		protected void paintComponent(java.awt.Graphics g) {
			if (g instanceof GLGraphics2D
					) {
				super.paintComponent(g);
			} else {
				System.out.println(g.getClass());
			}
		}
	};
	bar.setIndeterminate(true);
	panel.add(bar, BorderLayout.SOUTH);
	panel.add(new JSlider(SwingConstants.VERTICAL, 0, 10, 3), BorderLayout.EAST);

	ButtonGroup grp = new ButtonGroup();
	JRadioButton radio1 = new JRadioButton("FM");
	JRadioButton radio2 = new JRadioButton("AM");
	grp.add(radio1);
	grp.add(radio2);

	JPanel panel2 = new JPanel(new GridLayout(0, 1));
	panel2.add(radio1);
	panel2.add(radio2);

	JComboBox b = new JComboBox(new String[] {"3", "4"});

	panel.add(b, BorderLayout.WEST);

	panel.setBorder(BorderFactory.createTitledBorder("Border"));

	return panel;
}
 
Example 3
Project: jdk8u-jdk   File: TSFrame.java   View Source Code Vote up 5 votes
NonOpaqueJFrame() {
    super("NonOpaque Swing JFrame");
    JPanel p = new JPanel() {
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            render(g, getWidth(), getHeight(), true);
            g.setColor(Color.red);
            g.drawString("Non-Opaque Swing JFrame", 10, 15);
        }
    };
    p.setDoubleBuffered(false);
    p.setOpaque(false);
    add(p);
    setUndecorated(true);
}
 
Example 4
Project: openjdk-jdk10   File: TSFrame.java   View Source Code Vote up 5 votes
NonOpaqueJFrame() {
    super("NonOpaque Swing JFrame");
    JPanel p = new JPanel() {
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            render(g, getWidth(), getHeight(), true);
            g.setColor(Color.red);
            g.drawString("Non-Opaque Swing JFrame", 10, 15);
        }
    };
    p.setDoubleBuffered(false);
    p.setOpaque(false);
    add(p);
    setUndecorated(true);
}