Search in sources :

Example 91 with Container

use of java.awt.Container in project jdk8u_jdk by JetBrains.

the class LaunchTool method configureAndConnect.

private void configureAndConnect(final Connector connector) {
    final JDialog dialog = new JDialog();
    final Map<String, Connector.Argument> args = connector.defaultArguments();
    dialog.setModal(true);
    dialog.setTitle("Connector Arguments");
    Container content = dialog.getContentPane();
    JPanel guts = new JPanel();
    Border etched = BorderFactory.createEtchedBorder();
    BorderFactory.createTitledBorder(etched, connector.description(), TitledBorder.LEFT, TitledBorder.TOP);
    guts.setBorder(etched);
    guts.setLayout(new BoxLayout(guts, BoxLayout.Y_AXIS));
    //        guts.add(new JLabel(connector.description()));
    final List<ArgRep> argReps = new ArrayList<ArgRep>(args.size());
    for (Connector.Argument arg : args.values()) {
        ArgRep ar;
        if (arg instanceof Connector.BooleanArgument) {
            ar = new BooleanArgRep((Connector.BooleanArgument) arg, guts);
        } else {
            ar = new StringArgRep(arg, guts);
        }
        argReps.add(ar);
    }
    content.add(guts);
    JPanel buttonPanel = okCancel(dialog, new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            for (ArgRep ar : argReps) {
                if (!ar.isSpecified()) {
                    JOptionPane.showMessageDialog(dialog, ar.arg.label() + ": Argument must be specified", "No argument", JOptionPane.ERROR_MESSAGE);
                    return;
                }
                if (!ar.isValid()) {
                    JOptionPane.showMessageDialog(dialog, ar.arg.label() + ": Bad argument value: " + ar.getText(), "Bad argument", JOptionPane.ERROR_MESSAGE);
                    return;
                }
                ar.install();
            }
            try {
                if (runtime.explictStart(connector, args)) {
                    dialog.setVisible(false);
                    dialog.dispose();
                } else {
                    JOptionPane.showMessageDialog(dialog, "Bad arguments values: See diagnostics window.", "Bad arguments", JOptionPane.ERROR_MESSAGE);
                }
            } catch (VMLaunchFailureException exc) {
                JOptionPane.showMessageDialog(dialog, "Launch Failure: " + exc, "Launch Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    content.add(BorderLayout.SOUTH, buttonPanel);
    dialog.pack();
    dialog.setVisible(true);
}
Also used : ActionEvent(java.awt.event.ActionEvent) ArrayList(java.util.ArrayList) Container(java.awt.Container) ActionListener(java.awt.event.ActionListener) Border(javax.swing.border.Border) TitledBorder(javax.swing.border.TitledBorder)

Example 92 with Container

use of java.awt.Container in project JMRI by JMRI.

the class ThrottleFrame method ynstrument.

// #JYNSTRUMENT# here instantiate the Jynstrument, put it in a component, initialize the context and start it
public JInternalFrame ynstrument(String path) {
    if (path == null) {
        return null;
    }
    // everything is there
    Jynstrument it = JynstrumentFactory.createInstrument(path, this);
    if (it == null) {
        log.error("Error while creating Jynstrument " + path);
        return null;
    }
    setTransparentBackground(it);
    JInternalFrame newiFrame = new JInternalFrame(it.getClassName());
    newiFrame.add(it);
    newiFrame.addInternalFrameListener(frameListener);
    newiFrame.setDoubleBuffered(true);
    newiFrame.setResizable(true);
    newiFrame.setClosable(true);
    newiFrame.setIconifiable(true);
    newiFrame.getContentPane().addContainerListener(new ContainerListener() {

        @Override
        public void componentAdded(ContainerEvent e) {
        }

        @Override
        public void componentRemoved(ContainerEvent e) {
            Container c = e.getContainer();
            while ((!(c instanceof JInternalFrame)) && (!(c instanceof TranslucentJPanel))) {
                c = c.getParent();
            }
            c.setVisible(false);
            remove(c);
            repaint();
        }
    });
    newiFrame.pack();
    add(newiFrame, PANEL_LAYER_FRAME);
    newiFrame.setVisible(true);
    return newiFrame;
}
Also used : ContainerEvent(java.awt.event.ContainerEvent) Jynstrument(jmri.jmrit.jython.Jynstrument) Container(java.awt.Container) ContainerListener(java.awt.event.ContainerListener) JInternalFrame(javax.swing.JInternalFrame)

Example 93 with Container

use of java.awt.Container in project processdash by dtuma.

the class TimeLogEditor method constructUserInterface.

/*
     * methods for constructing the user interface
     */
private void constructUserInterface() {
    loadCustomDimensions();
    frame = new JFrame(getResource("Time_Log_Editor_Window_Title"));
    DashboardIconFactory.setWindowIcon(frame);
    frame.setSize(new Dimension(frameWidth, frameHeight));
    frame.addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent e) {
            confirmClose(true);
        }
    });
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    PCSH.enableHelpKey(frame, "UsingTimeLogEditor");
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, constructTreePanel(), constructEditPanel());
    splitPane.setDividerLocation(dividerLocation);
    // Setup drag-and-drop support on Java 6 and above
    new FallbackObjectFactory<TimeLogEditorDragDropSetup>(TimeLogEditorDragDropSetup.class).add(//
    "TimeLogEditorDragDropSetupJava6").get(true).setupEditorForDragDrop(this);
    Container panel = frame.getContentPane();
    panel.setLayout(new BorderLayout());
    panel.add(BorderLayout.NORTH, constructFilterPanel());
    panel.add(BorderLayout.CENTER, splitPane);
    panel.add(BorderLayout.SOUTH, constructControlPanel());
    createRecalcTimer();
}
Also used : Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension) JSplitPane(javax.swing.JSplitPane)

Example 94 with Container

use of java.awt.Container in project processdash by dtuma.

the class PreferencesDialog method reload.

private void reload() {
    List panesDefinitions = ExtensionManager.getXmlConfigurationElements(PREFERENCES_PANE_TAG_NAME);
    List<PreferencesPane> panes = getPreferencesPanes(panesDefinitions);
    Vector<PreferencesCategory> categories = getPreferencesGategories(panes);
    Container pane = this.getContentPane();
    pane.removeAll();
    pane.setLayout(new BorderLayout());
    pane.add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, getCategoryChooser(categories), preferencesPanels), BorderLayout.CENTER);
    pane.add(getBottomSection(), BorderLayout.PAGE_END);
}
Also used : Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) ArrayList(java.util.ArrayList) JList(javax.swing.JList) List(java.util.List) JSplitPane(javax.swing.JSplitPane)

Example 95 with Container

use of java.awt.Container in project cytoscape-api by cytoscape.

the class WebServiceGUIClientTest method testGetQueryBuilderGUI.

@Override
public void testGetQueryBuilderGUI() {
    WebServiceGUIClient client = new DummyGUIClient("test.xml", "dummy", "dummyClinet");
    final Container clientGUI = client.getQueryBuilderGUI();
    assertNotNull(clientGUI);
    assertEquals(JPanel.class, clientGUI.getClass());
}
Also used : Container(java.awt.Container) AbstractWebServiceGUIClient(org.cytoscape.io.webservice.swing.AbstractWebServiceGUIClient) WebServiceGUIClient(org.cytoscape.io.webservice.swing.WebServiceGUIClient)

Aggregations

Container (java.awt.Container)250 JPanel (javax.swing.JPanel)70 JLabel (javax.swing.JLabel)65 JButton (javax.swing.JButton)56 JScrollPane (javax.swing.JScrollPane)55 BoxLayout (javax.swing.BoxLayout)50 FlowLayout (java.awt.FlowLayout)49 Component (java.awt.Component)46 BorderLayout (java.awt.BorderLayout)44 Dimension (java.awt.Dimension)39 ActionEvent (java.awt.event.ActionEvent)38 ActionListener (java.awt.event.ActionListener)26 JComponent (javax.swing.JComponent)22 JFrame (javax.swing.JFrame)22 JmriJFrame (jmri.util.JmriJFrame)20 Border (javax.swing.border.Border)18 JTable (javax.swing.JTable)17 JTextArea (javax.swing.JTextArea)17 Frame (java.awt.Frame)16 JTextField (javax.swing.JTextField)16