Java Code Examples for javax.swing.JPanel.getBackground()

The following are Jave code examples for showing how to use getBackground() of the javax.swing.JPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Logisim   File: SplashScreen.java   View Source Code Vote up 7 votes
public SplashScreen() {
	JPanel imagePanel = About.getImagePanel();
	imagePanel.setBorder(null);

	progress.setStringPainted(true);

	JPanel buttonPanel = new JPanel();
	buttonPanel.add(close);
	close.addActionListener(this);
	buttonPanel.add(cancel);
	cancel.addActionListener(this);

	JPanel contents = new JPanel(new BorderLayout());
	contents.add(imagePanel, BorderLayout.NORTH);
	contents.add(progress, BorderLayout.CENTER);
	contents.add(buttonPanel, BorderLayout.SOUTH);
	contents.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));

	Color bg = imagePanel.getBackground();
	contents.setBackground(bg);
	buttonPanel.setBackground(bg);
	setBackground(bg);
	setContentPane(contents);
}
 
Example 2
Project: ramus   File: Handler.java   View Source Code Vote up 5 votes
public DraggingWindow(final Window ancestor) {
    super(ancestor);

    Color myFloatColor = UIManager
            .getColor("ToolBar.floatingForeground");
    Color myDockColor = UIManager.getColor("ToolBar.dockingForeground");
    if (myFloatColor == null)
        myFloatColor = Color.darkGray;
    if (myDockColor == null)
        myDockColor = Color.yellow;

    myFloatBorder = BorderFactory.createLineBorder(myFloatColor, 3);
    myDockBorder = BorderFactory.createLineBorder(myDockColor, 3);

    myContent = new JPanel();
    myContent.setOpaque(true);

    myFloatColor = UIManager.getColor("ToolBar.floatingBackground");
    myDockColor = UIManager.getColor("ToolBar.dockingBackground");
    if (myFloatColor == null)
        myFloatColor = myContent.getBackground();
    if (myDockColor == null)
        myDockColor = myContent.getBackground();

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(myContent, BorderLayout.CENTER);
}