當前位置: 首頁>>代碼示例>>Java>>正文


Java JDesktopPane.setBackground方法代碼示例

本文整理匯總了Java中javax.swing.JDesktopPane.setBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java JDesktopPane.setBackground方法的具體用法?Java JDesktopPane.setBackground怎麽用?Java JDesktopPane.setBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JDesktopPane的用法示例。


在下文中一共展示了JDesktopPane.setBackground方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createAndShowGUI

import javax.swing.JDesktopPane; //導入方法依賴的package包/類
private static void createAndShowGUI() {

        frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLayout(new BorderLayout());

        desktopPane = new JDesktopPane();
        desktopPane.setBackground(BACKGROUND_COLOR);

        frame.add(desktopPane, BorderLayout.CENTER);
        frame.setSize(FRAME_SIZE, FRAME_SIZE);
        frame.setVisible(true);

        internalFrame = new JInternalFrame("Test");
        internalFrame.setSize(FRAME_SIZE / 2, FRAME_SIZE / 2);
        desktopPane.add(internalFrame);
        internalFrame.setVisible(true);
        internalFrame.setResizable(true);

        frame.setVisible(true);
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:JInternalFrameDraggingTest.java

示例2: ViewingPanel

import javax.swing.JDesktopPane; //導入方法依賴的package包/類
/**
    * Create a panel in which a JDesktopPane is used to
    * to display screens for viewing a Player.
    *
    * @param          title
    *                 Title displayed in border of JDesktopPane
    */
   public ViewingPanel(String title) {
TitledBorder	tb;
setLayout(new BorderLayout());
desktop = new JDesktopPane();
desktop.setLayout(new TileLayout());
desktop.setBorder(tb = new TitledBorder(
			new CompoundBorder(
				new EtchedBorder(),
				new EmptyBorder(4, 4, 4, 4)),
			title));

tb.setTitleColor(Color.black);
desktop.setOpaque(false);
 	desktop.setBackground(UIManager.getColor("control"));
       add(desktop, BorderLayout.CENTER);
hash = new Hashtable();
   }
 
開發者ID:champtar,項目名稱:fmj-sourceforge-mirror,代碼行數:25,代碼來源:ViewingPanel.java

示例3: createAndShowGUI

import javax.swing.JDesktopPane; //導入方法依賴的package包/類
private static void createAndShowGUI() {

        frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JDesktopPane desktopPane = new JDesktopPane();
        desktopPane.setBackground(DESKTOPPANE_COLOR);

        internalFrame = new JInternalFrame("Test") {

            @Override
            public void paint(Graphics g) {
                super.paint(g);
                g.setColor(FRAME_COLOR);
                g.fillRect(0, 0, getWidth(), getHeight());
            }
        };
        internalFrame.setSize(WIN_WIDTH / 3, WIN_HEIGHT / 3);
        internalFrame.setVisible(true);
        desktopPane.add(internalFrame);

        JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());
        panel.add(desktopPane, BorderLayout.CENTER);
        frame.add(panel);
        frame.setSize(WIN_WIDTH, WIN_HEIGHT);
        frame.setVisible(true);
        frame.requestFocus();
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:30,代碼來源:bug8069348.java

示例4: MainContainer

import javax.swing.JDesktopPane; //導入方法依賴的package包/類
/**
 * Create the frame.
 */
public MainContainer() {
	
	//Make the big window be indented 50 pixels from each edge
       //of the screen.
       int inset = 50;
       Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
       setBounds(inset, inset,
                 screenSize.width  - inset*2,
                 screenSize.height - inset*2);
       
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	//setBounds(100, 100, 1145, 664);
	JPanel contentPane = new JPanel();
	setContentPane(contentPane);
	contentPane.setLayout(new BorderLayout(0, 0));
	
	JPanel menuContainer = new JPanel();
	//menuContainer.setBorder(new LineBorder(new Color(0, 0, 0)));
	contentPane.add(menuContainer, BorderLayout.NORTH);
	menuContainer.setPreferredSize(new Dimension((int) contentPane.getSize().getWidth(), 140));
	menuContainer.setLayout(new BorderLayout(0, 0));
	
	ToolBarContainer toolMenu = new ToolBarContainer(this, this.getWidth(),160);
	toolMenu.setBorder(new LineBorder(Color.GREEN));
	menuContainer.add(toolMenu, BorderLayout.CENTER);
	
	desktopContainerPanel = new JDesktopPane();
	desktopContainerPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
	desktopContainerPanel.setBackground(UIManager.getColor("InternalFrame.activeTitleBackground"));
	desktopContainerPanel.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
	contentPane.add(desktopContainerPanel);
	
	//createFrame(desktopContainerPanel, new MyInternalFrame()); //Create first window
	
	JPanel statusPanel = new JPanel();
	statusPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
	statusPanel.setPreferredSize(new Dimension(1145, 30));
	contentPane.add(statusPanel, BorderLayout.SOUTH);
	
	JLabel lblNewLabel = new JLabel("iEATool");
	statusPanel.add(lblNewLabel);
}
 
開發者ID:connect2vishal,項目名稱:iEATool,代碼行數:46,代碼來源:MainContainer.java


注:本文中的javax.swing.JDesktopPane.setBackground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。