Search in sources :

Example 6 with JDesktopPane

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");
    }
}
Also used : JDesktopPane(javax.swing.JDesktopPane) JTextArea(javax.swing.JTextArea) JRadioButton(javax.swing.JRadioButton) JLayeredPane(javax.swing.JLayeredPane) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) JProgressBar(javax.swing.JProgressBar) JTableHeader(javax.swing.table.JTableHeader) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator) JScrollBar(javax.swing.JScrollBar) JTextPane(javax.swing.JTextPane) JToggleButton(javax.swing.JToggleButton) JSlider(javax.swing.JSlider) JMenuItem(javax.swing.JMenuItem) JComponent(javax.swing.JComponent) Component(java.awt.Component) JScrollPane(javax.swing.JScrollPane) JViewport(javax.swing.JViewport) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JToolBar(javax.swing.JToolBar) JOptionPane(javax.swing.JOptionPane) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JPopupMenu(javax.swing.JPopupMenu) JCheckBox(javax.swing.JCheckBox) JTree(javax.swing.JTree) JFileChooser(javax.swing.JFileChooser) JPasswordField(javax.swing.JPasswordField) JTable(javax.swing.JTable) JEditorPane(javax.swing.JEditorPane) JSpinner(javax.swing.JSpinner) JRootPane(javax.swing.JRootPane) JSplitPane(javax.swing.JSplitPane) JColorChooser(javax.swing.JColorChooser) JInternalFrame(javax.swing.JInternalFrame) JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Example 7 with JDesktopPane

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);
}
Also used : JDesktopPane(javax.swing.JDesktopPane)

Example 8 with JDesktopPane

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");
    }
}
Also used : JDesktopPane(javax.swing.JDesktopPane) JFrame(javax.swing.JFrame) Color(java.awt.Color) JButton(javax.swing.JButton) Rectangle(java.awt.Rectangle) SunToolkit(sun.awt.SunToolkit) Robot(java.awt.Robot) BufferedImage(java.awt.image.BufferedImage) AWTException(java.awt.AWTException)

Example 9 with JDesktopPane

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();
}
Also used : JDesktopPane(javax.swing.JDesktopPane) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension)

Example 10 with JDesktopPane

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);
}
Also used : JDesktopPane(javax.swing.JDesktopPane)

Aggregations

JDesktopPane (javax.swing.JDesktopPane)10 JFrame (javax.swing.JFrame)4 JMenu (javax.swing.JMenu)4 JMenuBar (javax.swing.JMenuBar)4 JMenuItem (javax.swing.JMenuItem)4 JSplitPane (javax.swing.JSplitPane)4 JButton (javax.swing.JButton)3 JInternalFrame (javax.swing.JInternalFrame)3 JLabel (javax.swing.JLabel)3 JScrollPane (javax.swing.JScrollPane)3 JSeparator (javax.swing.JSeparator)3 Component (java.awt.Component)2 Dimension (java.awt.Dimension)2 Robot (java.awt.Robot)2 WindowAdapter (java.awt.event.WindowAdapter)2 WindowEvent (java.awt.event.WindowEvent)2 UnresolvableException (alma.acs.commandcenter.util.VariableString.UnresolvableException)1 AWTException (java.awt.AWTException)1 BorderLayout (java.awt.BorderLayout)1 Button (java.awt.Button)1