Java Code Examples for java.awt.Frame#getBackground()
The following examples show how to use
java.awt.Frame#getBackground() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChildWindowProperties.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void testChildPropertiesWithFrameAsParent() { parentFrame = new Frame("parent Frame"); parentFrame.setSize(WIDTH, HEIGHT); parentFrame.setLocation(100, 400); parentFrame.setBackground(Color.BLUE); parentLabel = new Label("ParentForegroundAndFont"); parentFont = new Font("Courier New", Font.ITALIC, 15); parentFrame.setForeground(Color.RED); parentFrame.setFont(parentFont); parentFrame.add(parentLabel); parentFrame.setVisible(true); frameChildWindow = new Window(parentFrame); frameChildWindow.setSize(WIDTH, HEIGHT); frameChildWindow.setLocation(WIDTH + 200, 400); childLabel = new Label("ChildForegroundAndFont"); frameChildWindow.add(childLabel); frameChildWindow.setVisible(true); if (parentFrame.getBackground() == frameChildWindow.getBackground()) { dispose(); throw new RuntimeException("Child Window Should NOT Inherit " + "Parent Frame's Background Color"); } if (parentDialog.getForeground() == windowChild.getForeground()) { dispose(); throw new RuntimeException("Child Window Should NOT Inherit " + "Parent Frame's Foreground Color"); } if (parentDialog.getFont() == windowChild.getFont()) { dispose(); throw new RuntimeException("Child Window Should NOT Inherit " + "Parent Frame's Font Color"); } }
Example 2
Source File: ChildDialogProperties.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void testChildPropertiesWithFrameAsParent() { parentFrame = new Frame("parent Frame"); parentFrame.setSize(WIDTH, HEIGHT); parentFrame.setLocation(100, 400); parentFrame.setBackground(Color.BLUE); parentLabel = new Label("ParentForegroundAndFont"); parentFont = new Font("Courier New", Font.ITALIC, 15); parentFrame.setForeground(Color.RED); parentFrame.setFont(parentFont); parentFrame.add(parentLabel); parentFrame.setVisible(true); frameChildDialog = new Dialog(parentFrame, "Frame's child"); frameChildDialog.setSize(WIDTH, HEIGHT); frameChildDialog.setLocation(WIDTH + 200, 400); childLabel = new Label("ChildForegroundAndFont"); frameChildDialog.add(childLabel); frameChildDialog.setVisible(true); if (parentFrame.getBackground() == frameChildDialog.getBackground()) { dispose(); throw new RuntimeException("Child Dialog Should NOT Inherit " + "Parent Frame's Background Color"); } if (parentFrame.getForeground() == frameChildDialog.getForeground()) { dispose(); throw new RuntimeException("Child Dialog Should NOT Inherit " + "Parent Frame's Foreground Color"); } if (parentFrame.getFont() == frameChildDialog.getFont()) { dispose(); throw new RuntimeException("Child Dialog Should NOT Inherit " + "Parent Frame's Font Style/Color"); } }