本文整理匯總了Java中javax.swing.JPanel.setDoubleBuffered方法的典型用法代碼示例。如果您正苦於以下問題:Java JPanel.setDoubleBuffered方法的具體用法?Java JPanel.setDoubleBuffered怎麽用?Java JPanel.setDoubleBuffered使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JPanel
的用法示例。
在下文中一共展示了JPanel.setDoubleBuffered方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: open
import javax.swing.JPanel; //導入方法依賴的package包/類
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);
}
}
示例2: createComponent
import javax.swing.JPanel; //導入方法依賴的package包/類
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;
}
示例3: NonOpaqueJFrame
import javax.swing.JPanel; //導入方法依賴的package包/類
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);
}