use of javax.swing.JDesktopPane in project jdk8u_jdk by JetBrains.
the class InsetsEncapsulation method run.
@Override
public void run() {
runTest(new JLabel("hi"));
runTest(new JMenu());
runTest(new JTree());
runTest(new JTable());
runTest(new JMenuItem());
runTest(new JCheckBoxMenuItem());
runTest(new JToggleButton());
runTest(new JSpinner());
runTest(new JSlider());
runTest(Box.createVerticalBox());
runTest(Box.createHorizontalBox());
runTest(new JTextField());
runTest(new JTextArea());
runTest(new JTextPane());
runTest(new JPasswordField());
runTest(new JFormattedTextField());
runTest(new JEditorPane());
runTest(new JButton());
runTest(new JColorChooser());
runTest(new JFileChooser());
runTest(new JCheckBox());
runTest(new JInternalFrame());
runTest(new JDesktopPane());
runTest(new JTableHeader());
runTest(new JLayeredPane());
runTest(new JRootPane());
runTest(new JMenuBar());
runTest(new JOptionPane());
runTest(new JRadioButton());
runTest(new JRadioButtonMenuItem());
runTest(new JPopupMenu());
runTest(new JScrollBar());
runTest(new JScrollPane());
runTest(new JViewport());
runTest(new JSplitPane());
runTest(new JTabbedPane());
runTest(new JToolBar());
runTest(new JSeparator());
runTest(new JProgressBar());
if (!failures.isEmpty()) {
System.out.println("These classes failed");
for (final Component failure : failures) {
System.out.println(failure.getClass());
}
throw new RuntimeException("Test failed");
}
}
use of javax.swing.JDesktopPane in project jdk8u_jdk by JetBrains.
the class MetalworksFrame method buildContent.
protected void buildContent() {
desktop = new JDesktopPane();
getContentPane().add(desktop);
}
use of javax.swing.JDesktopPane in project jdk8u_jdk by JetBrains.
the class bug7154030 method main.
public static void main(String[] args) throws Exception {
BufferedImage imageInit = null;
BufferedImage imageShow = null;
BufferedImage imageHide = null;
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
Robot robot = new Robot();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
JDesktopPane desktop = new JDesktopPane();
button = new JButton("button");
JFrame frame = new JFrame();
button.setSize(200, 200);
button.setLocation(100, 100);
button.setForeground(Color.RED);
button.setBackground(Color.RED);
button.setOpaque(true);
button.setVisible(false);
desktop.add(button);
frame.setContentPane(desktop);
frame.setSize(300, 300);
frame.setLocation(0, 0);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
});
toolkit.realSync();
imageInit = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
button.show();
}
});
toolkit.realSync();
imageShow = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
if (Util.compareBufferedImages(imageInit, imageShow)) {
throw new Exception("Failed to show opaque button");
}
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
button.hide();
}
});
toolkit.realSync();
imageHide = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
if (!Util.compareBufferedImages(imageInit, imageHide)) {
throw new Exception("Failed to hide opaque button");
}
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
button.setOpaque(false);
button.setBackground(new Color(128, 128, 0));
button.setVisible(false);
}
});
toolkit.realSync();
imageInit = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
button.show();
}
});
toolkit.realSync();
imageShow = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
button.hide();
}
});
if (Util.compareBufferedImages(imageInit, imageShow)) {
throw new Exception("Failed to show non-opaque button");
}
toolkit.realSync();
imageHide = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
if (!Util.compareBufferedImages(imageInit, imageHide)) {
throw new Exception("Failed to hide non-opaque button");
}
}
use of javax.swing.JDesktopPane in project JMRI by JMRI.
the class LearnThrottleFrame method initGUI.
private void initGUI() {
setTitle("Throttle");
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
_warrantFrame.stopRunTrain();
dispose();
}
});
initializeMenu();
_functionPanel = new FunctionPanel(_warrantFrame.getTrain(), this);
// assumes button width of 54, height of 30 (set in class FunctionButton) with
// horiz and vert gaps of 5 each (set in FunctionPanel class)
// with 3 buttons across and 6 rows high
// = 192
int width = 3 * (FunctionButton.getButtonWidth()) + 2 * 3 * 5;
// = 240 (another 10 needed?)
int height = 6 * (FunctionButton.getButtonHeight()) + 2 * 6 * 5 + 10;
_functionPanel.setSize(width, height);
_functionPanel.setVisible(true);
_functionPanel.setEnabled(false);
//functionPanel.addInternalFrameListener(InternalFrameAdapter);
_controlPanel = new ControlPanel(this);
_controlPanel.setVisible(true);
_controlPanel.setEnabled(false);
_controlPanel.setSize(_controlPanel.getPreferredSize().width, height);
_buttonPanel = new ButtonFrame();
_buttonPanel.setVisible(true);
_buttonPanel.setEnabled(false);
_buttonPanel.setSize(_controlPanel.getWidth() + _functionPanel.getWidth(), _buttonPanel.getPreferredSize().height);
_buttonPanel.setLocation(0, 0);
_controlPanel.setLocation(0, _buttonPanel.getHeight());
_functionPanel.setLocation(_controlPanel.getWidth(), _buttonPanel.getHeight());
getContentPane().add(_buttonPanel);
JDesktopPane desktop = new JDesktopPane();
getContentPane().add(desktop);
desktop.add(_controlPanel);
desktop.add(_functionPanel);
desktop.setPreferredSize(new Dimension(Math.max(_controlPanel.getWidth() + _functionPanel.getWidth(), _buttonPanel.getWidth()), Math.max(_functionPanel.getHeight(), _controlPanel.getHeight()) + _buttonPanel.getHeight()));
// Install the Key bindings on all Components
KeyListenerInstaller.installKeyListenerOnAllComponents(new ControlPadKeyListener(), this);
setResizable(false);
pack();
}
use of javax.swing.JDesktopPane in project pcgen by PCGen.
the class DiceBagPluginView method initComponents.
/**
* <p>Initializes all the components of the view.</p>
*/
private void initComponents() {
theDesktop = new JDesktopPane();
theDesktop.setBackground(Color.LIGHT_GRAY);
}
Aggregations