当前位置: 首页>>代码示例>>Java>>正文


Java JFrame.setBackground方法代码示例

本文整理汇总了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);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:19,代码来源:QnactrSimulation.java

示例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);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:19,代码来源:QnactrSimulation.java

示例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();
}
 
开发者ID:OzodbekKamolov,项目名称:N-Queen-Puzzle-Knight-sTour,代码行数:26,代码来源:Knight.java

示例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();
			}
		});
	}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:25,代码来源:DynamicDisplay.java

示例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);
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:13,代码来源:Shapes2.java

示例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);
 }
 
开发者ID:OzodbekKamolov,项目名称:N-Queen-Puzzle-Knight-sTour,代码行数:16,代码来源:Queen.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:ComponentResizeTest.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:bug8041561.java


注:本文中的javax.swing.JFrame.setBackground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。