Search in sources :

Example 76 with Container

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

the class LogixTableAction method makeWhereUsedWindow.

// *********** Methods for Conditional References Window ********************
/**
     * Builds the conditional references window when the Conditional Variable
     * References menu item is selected.
     * <p>
     * This is a stand-alone window that can be closed at any time.
     * @since 4.7.4
     */
void makeWhereUsedWindow() {
    JmriJFrame referenceListFrame = new JmriJFrame(rbx.getString("LabelRefTitle"));
    Container contentPane = referenceListFrame.getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    // build header information
    JPanel panel1 = new JPanel();
    panel1.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5));
    panel1.add(new JLabel(rbx.getString("LabelRefTarget")));
    panel1.add(new JLabel(rbx.getString("LabelRefSource")));
    contentPane.add(panel1);
    JScrollPane scrollPane = null;
    condText = new javax.swing.JTextArea(50, 50);
    // Build the conditional references listing
    buildWhereUsedListing();
    scrollPane = new JScrollPane(condText);
    contentPane.add(scrollPane);
    referenceListFrame.pack();
    referenceListFrame.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) Container(java.awt.Container) FlowLayout(java.awt.FlowLayout) JmriJFrame(jmri.util.JmriJFrame) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) JTextArea(javax.swing.JTextArea)

Example 77 with Container

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

the class LogixTableAction method makeAddLogixFrame.

/**
     * Create or copy Logix frame.
     *
     * @param titleId property key to fetch as title of the frame
     * @param messageId part 1 of property key to fetch as user instruction on pane,
     *                  either 1 or 2 is added to form the whole key
     * @return the button JPanel
     */
JPanel makeAddLogixFrame(String titleId, String messageId) {
    addLogixFrame = new JmriJFrame(rbx.getString(titleId));
    addLogixFrame.addHelpMenu("package.jmri.jmrit.beantable.LogixAddEdit", true);
    addLogixFrame.setLocation(50, 30);
    Container contentPane = addLogixFrame.getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    JPanel p;
    p = new JPanel();
    p.setLayout(new FlowLayout());
    p.setLayout(new java.awt.GridBagLayout());
    java.awt.GridBagConstraints c = new java.awt.GridBagConstraints();
    c.gridwidth = 1;
    c.gridheight = 1;
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = java.awt.GridBagConstraints.EAST;
    p.add(_sysNameLabel, c);
    c.gridy = 1;
    p.add(_userNameLabel, c);
    c.gridx = 1;
    c.gridy = 0;
    c.anchor = java.awt.GridBagConstraints.WEST;
    c.weightx = 1.0;
    // text field will expand
    c.fill = java.awt.GridBagConstraints.HORIZONTAL;
    p.add(_systemName, c);
    c.gridy = 1;
    p.add(_addUserName, c);
    c.gridx = 2;
    c.gridy = 1;
    c.anchor = java.awt.GridBagConstraints.WEST;
    c.weightx = 1.0;
    // text field will expand
    c.fill = java.awt.GridBagConstraints.HORIZONTAL;
    c.gridy = 0;
    p.add(_autoSystemName, c);
    _addUserName.setToolTipText(rbx.getString("LogixUserNameHint"));
    _systemName.setToolTipText(rbx.getString("LogixSystemNameHint"));
    contentPane.add(p);
    // set up message
    JPanel panel3 = new JPanel();
    panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS));
    JPanel panel31 = new JPanel();
    panel31.setLayout(new FlowLayout());
    JLabel message1 = new JLabel(rbx.getString(messageId + "1"));
    panel31.add(message1);
    JPanel panel32 = new JPanel();
    JLabel message2 = new JLabel(rbx.getString(messageId + "2"));
    panel32.add(message2);
    panel3.add(panel31);
    panel3.add(panel32);
    contentPane.add(panel3);
    // set up create and cancel buttons
    JPanel panel5 = new JPanel();
    panel5.setLayout(new FlowLayout());
    // Cancel
    JButton cancel = new JButton(Bundle.getMessage("ButtonCancel"));
    panel5.add(cancel);
    cancel.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            cancelAddPressed(e);
        }
    });
    cancel.setToolTipText(rbx.getString("CancelLogixButtonHint"));
    addLogixFrame.addWindowListener(new java.awt.event.WindowAdapter() {

        @Override
        public void windowClosing(java.awt.event.WindowEvent e) {
            cancelAddPressed(null);
        }
    });
    contentPane.add(panel5);
    _autoSystemName.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            autoSystemName();
        }
    });
    return panel5;
}
Also used : JPanel(javax.swing.JPanel) ItemEvent(java.awt.event.ItemEvent) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Container(java.awt.Container) ActionListener(java.awt.event.ActionListener) JmriJFrame(jmri.util.JmriJFrame) ItemListener(java.awt.event.ItemListener)

Example 78 with Container

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

the class LogixTableAction method makeBrowserWindow.

// buildConditionalListing
/**
     * creates and initializes the conditionals browser window
     */
void makeBrowserWindow() {
    condBrowserFrame = new JmriJFrame(rbx.getString("BrowserTitle"));
    condBrowserFrame.addHelpMenu("package.jmri.jmrit.beantable.LogixAddEdit", true);
    Container contentPane = condBrowserFrame.getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    // LOGIX header information
    JPanel panel1 = new JPanel();
    panel1.setLayout(new FlowLayout());
    String tStr = rbx.getString("BrowserLogix") + " " + _curLogix.getSystemName() + "    " + _curLogix.getUserName() + "    " + (Boolean.valueOf(_curLogix.getEnabled()) ? rbx.getString("BrowserEnabled") : rbx.getString("BrowserDisabled"));
    panel1.add(new JLabel(tStr));
    contentPane.add(panel1);
    JScrollPane scrollPane = null;
    condText = new javax.swing.JTextArea(50, 50);
    condText.setEditable(false);
    condText.setTabSize(4);
    // Build the conditionals listing
    buildConditionalListing();
    scrollPane = new JScrollPane(condText);
    contentPane.add(scrollPane);
    condBrowserFrame.pack();
    condBrowserFrame.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) Container(java.awt.Container) FlowLayout(java.awt.FlowLayout) JmriJFrame(jmri.util.JmriJFrame) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) JTextArea(javax.swing.JTextArea)

Example 79 with Container

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

the class NodeConfigFrame method initComponents.

/**
     * Initialize the config window
     */
@Override
public void initComponents() {
    setTitle(rb.getString("WindowTitle"));
    Container contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    // Set up node address and node type
    JPanel panel1 = new JPanel();
    panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS));
    // panel11 is the node address and type
    JPanel panel11 = new JPanel();
    panel11.setLayout(new FlowLayout());
    panel11.add(new JLabel(rb.getString("LabelNodeAddress") + " "));
    panel11.add(nodeAddrField);
    nodeAddrField.setToolTipText(rb.getString("TipNodeAddress"));
    nodeAddrField.setText("0");
    panel11.add(nodeAddrStatic);
    nodeAddrStatic.setVisible(false);
    panel11.add(new JLabel("   " + rb.getString("LabelNodeType") + " "));
    nodeTypeBox = new JComboBox<String>(SerialNode.getBoardNames());
    panel11.add(nodeTypeBox);
    nodeTypeBox.setToolTipText(rb.getString("TipNodeType"));
    contentPane.add(panel11);
    // Set up the notes panel
    JPanel panel3 = new JPanel();
    panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS));
    JPanel panel31 = new JPanel();
    panel31.setLayout(new FlowLayout());
    statusText1.setText(stdStatus1);
    statusText1.setVisible(true);
    panel31.add(statusText1);
    JPanel panel32 = new JPanel();
    panel32.setLayout(new FlowLayout());
    statusText2.setText(stdStatus2);
    statusText2.setVisible(true);
    panel32.add(statusText2);
    JPanel panel33 = new JPanel();
    panel33.setLayout(new FlowLayout());
    statusText3.setText(stdStatus3);
    statusText3.setVisible(true);
    panel33.add(statusText3);
    panel3.add(panel31);
    panel3.add(panel32);
    panel3.add(panel33);
    Border panel3Border = BorderFactory.createEtchedBorder();
    Border panel3Titled = BorderFactory.createTitledBorder(panel3Border, rb.getString("BoxLabelNotes"));
    panel3.setBorder(panel3Titled);
    contentPane.add(panel3);
    // Set up buttons
    JPanel panel4 = new JPanel();
    panel4.setLayout(new FlowLayout());
    addButton.setText(rb.getString("ButtonAdd"));
    addButton.setVisible(true);
    addButton.setToolTipText(rb.getString("TipAddButton"));
    addButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            addButtonActionPerformed();
        }
    });
    panel4.add(addButton);
    editButton.setText(rb.getString("ButtonEdit"));
    editButton.setVisible(true);
    editButton.setToolTipText(rb.getString("TipEditButton"));
    panel4.add(editButton);
    editButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            editButtonActionPerformed();
        }
    });
    panel4.add(deleteButton);
    deleteButton.setText(rb.getString("ButtonDelete"));
    deleteButton.setVisible(true);
    deleteButton.setToolTipText(rb.getString("TipDeleteButton"));
    panel4.add(deleteButton);
    deleteButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            deleteButtonActionPerformed();
        }
    });
    panel4.add(doneButton);
    doneButton.setText(rb.getString("ButtonDone"));
    doneButton.setVisible(true);
    doneButton.setToolTipText(rb.getString("TipDoneButton"));
    panel4.add(doneButton);
    doneButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            doneButtonActionPerformed();
        }
    });
    panel4.add(updateButton);
    updateButton.setText(rb.getString("ButtonUpdate"));
    updateButton.setVisible(true);
    updateButton.setToolTipText(rb.getString("TipUpdateButton"));
    panel4.add(updateButton);
    updateButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            updateButtonActionPerformed();
        }
    });
    updateButton.setVisible(false);
    panel4.add(cancelButton);
    cancelButton.setText(rb.getString("ButtonCancel"));
    cancelButton.setVisible(true);
    cancelButton.setToolTipText(rb.getString("TipCancelButton"));
    panel4.add(cancelButton);
    cancelButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            cancelButtonActionPerformed();
        }
    });
    cancelButton.setVisible(false);
    contentPane.add(panel4);
    // pack for display
    pack();
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) Container(java.awt.Container) Border(javax.swing.border.Border)

Example 80 with Container

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

the class JDesktopPane method getAllFrames.

private static Collection<JInternalFrame> getAllFrames(Container parent) {
    int i, count;
    Collection<JInternalFrame> results = new LinkedHashSet<>();
    count = parent.getComponentCount();
    for (i = 0; i < count; i++) {
        Component next = parent.getComponent(i);
        if (next instanceof JInternalFrame) {
            results.add((JInternalFrame) next);
        } else if (next instanceof JInternalFrame.JDesktopIcon) {
            JInternalFrame tmp = ((JInternalFrame.JDesktopIcon) next).getInternalFrame();
            if (tmp != null) {
                results.add(tmp);
            }
        } else if (next instanceof Container) {
            results.addAll(getAllFrames((Container) next));
        }
    }
    return results;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Container(java.awt.Container) Component(java.awt.Component)

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