本文整理汇总了Java中javax.swing.JFrame.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.setBackground方法的具体用法?Java JFrame.setBackground怎么用?Java JFrame.setBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.setBackground方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAndShowTaskVisualization2DViewerGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void createAndShowTaskVisualization2DViewerGUI() {
frameTaskVisualization2DViewer = new JFrame("TaskVisualization2DViewer");
frameTaskVisualization2DViewer.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
taskVisualization2D = new TaskVisualization2D();
taskVisualization2D.setOpaque(true); //content panes must be opaque
frameTaskVisualization2DViewer.setContentPane(taskVisualization2D);
frameTaskVisualization2DViewer.pack();
frameTaskVisualization2DViewer.setLocationByPlatform(true);
frameTaskVisualization2DViewer.setVisible(true);
int x = simulatedWindowDefaultSizeX + taskVisualization2DExtendSizeX;
int y = simulatedWindowDefaultSizeY + taskVisualization2DExtendSizeY;
frameTaskVisualization2DViewer.setSize(x, y);
frameTaskVisualization2DViewer.setBackground(Color.WHITE);
}
示例2: createAndShowTaskVisualization3DViewerGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void createAndShowTaskVisualization3DViewerGUI() {
frameTaskVisualization3DViewer = new JFrame("TaskVisualization3DViewer");
frameTaskVisualization3DViewer.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
taskVisualization3D = new TaskVisualization3D();
taskVisualization3D.setOpaque(true); //content panes must be opaque
frameTaskVisualization3DViewer.setContentPane(taskVisualization3D);
frameTaskVisualization3DViewer.pack();
frameTaskVisualization3DViewer.setLocationByPlatform(true);
frameTaskVisualization3DViewer.setVisible(true);
int x = taskVisualization3DSizeX;
int y = taskVisualization3DSizeY;
frameTaskVisualization3DViewer.setSize(x, y);
frameTaskVisualization3DViewer.setBackground(Color.WHITE);
}
示例3: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args){
dimension = Integer.parseInt(args[0]);
size = Integer.parseInt(args[1]);
//margin = (args[2].equals("1")) ? size : 0;
bigDim = dimension + 4;
dim = dimension * size;
frame = new JFrame();
frame.setSize(dim+2*margin, dim+2*margin+size/2);
frame.getContentPane().add(new Knight());
frame.setLocationRelativeTo(null);
frame.setBackground(Color.LIGHT_GRAY);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
JButton btnNext = new JButton();
btnNext.setVisible(true);
frame.add(btnNext);
btnNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
step++;
}
});
start();
}
示例4: initializeFrame
import javax.swing.JFrame; //导入方法依赖的package包/类
public void initializeFrame(){
// Main frame
f = new JFrame("Dynamic Simulation Display");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(DYNAMIC_FRAME_WIDTH, DYNAMIC_FRAME_HEIGHT);
f.setUndecorated(true);
f.setBackground(Color.BLACK);
f.setLayout(null);
f.setLocationRelativeTo(null);
f.setResizable(false);
f.add(new JLabel("test label"));
// Add the dynamic track view panel
f.add(dynamicTrackView);
dynamicTrackView.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
dynamicTrackView.showArrows = !dynamicTrackView.showArrows;
dynamicTrackView.refresh();
}
});
}
示例5: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args)
{
// create frame for Shapes2JPanel
JFrame frame = new JFrame("Drawing 2D Shapes");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Shapes2JPanel shapes2JPanel = new Shapes2JPanel();
frame.add(shapes2JPanel);
frame.setBackground(Color.WHITE);
frame.setSize(315, 330);
frame.setVisible(true);
}
示例6: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args){
dimension = Integer.parseInt(args[0]);
size = Integer.parseInt(args[1]);
dim = dimension * size;
JFrame frame = new JFrame();
frame.setSize(dim+2* + margin, dim+2* + margin + size / 2);
frame.getContentPane().add(new Queen());
frame.setLocationRelativeTo(null);
frame.setBackground(Color.LIGHT_GRAY);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
t = new char[dimension][dimension];
enumerate(dimension);
}
示例7: createAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createAndShowGUI() {
demoFrame = new JFrame();
demoFrame.setSize(300, 300);
demoFrame.setLayout(new FlowLayout());
demoFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
demoFrame.setUndecorated(true);
demoFrame.setBackground(new Color(0f, 0, 0, 0.1f));
JCheckBox b = new JCheckBox("Whatever");
demoFrame.paintAll(null);
b.setOpaque(true);
demoFrame.add(b);
demoFrame.add(new JButton());
demoFrame.setVisible(true);
}
示例8: createAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createAndShowGUI() {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBackground(Color.BLUE);
radioButton = new JRadioButton();
radioButton.setOpaque(false);
JPanel panel = new JPanel();
panel.setBackground(Color.BLUE);
panel.add(radioButton);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
}