本文整理汇总了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);
}