Search in sources :

Example 96 with Container

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

the class XComponentPeer method getParentTopLevel.

XWindowPeer getParentTopLevel() {
    AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
    Container parent = (target instanceof Container) ? ((Container) target) : (compAccessor.getParent(target));
    // Search for parent window
    while (parent != null && !(parent instanceof Window)) {
        parent = compAccessor.getParent(parent);
    }
    if (parent != null) {
        return (XWindowPeer) compAccessor.getPeer(parent);
    } else {
        return null;
    }
}
Also used : Window(java.awt.Window) Container(java.awt.Container)

Example 97 with Container

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

the class XComponentPeer method addTree.

private void addTree(Collection order, Set set, Container cont) {
    for (int i = 0; i < cont.getComponentCount(); i++) {
        Component comp = cont.getComponent(i);
        ComponentPeer peer = comp.getPeer();
        if (peer instanceof XComponentPeer) {
            Long window = Long.valueOf(((XComponentPeer) peer).getWindow());
            if (!set.contains(window)) {
                set.add(window);
                order.add(window);
            }
        } else if (comp instanceof Container) {
            // It is lightweight container, it might contain heavyweight components attached to this
            // peer
            addTree(order, set, (Container) comp);
        }
    }
}
Also used : Container(java.awt.Container) Component(java.awt.Component) ComponentPeer(java.awt.peer.ComponentPeer)

Example 98 with Container

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

the class XComponentPeer method isObscured.

public boolean isObscured() {
    Container container = (target instanceof Container) ? (Container) target : target.getParent();
    if (container == null) {
        return true;
    }
    Container parent;
    while ((parent = container.getParent()) != null) {
        container = parent;
    }
    if (container instanceof Window) {
        XWindowPeer wpeer = (XWindowPeer) (container.getPeer());
        if (wpeer != null) {
            return (wpeer.winAttr.visibilityState != wpeer.winAttr.AWT_UNOBSCURED);
        }
    }
    return true;
}
Also used : Window(java.awt.Window) Container(java.awt.Container)

Example 99 with Container

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

the class WPageDialog method addNotify.

@Override
@SuppressWarnings("deprecation")
public void addNotify() {
    synchronized (getTreeLock()) {
        Container parent = getParent();
        if (parent != null && parent.getPeer() == null) {
            parent.addNotify();
        }
        if (getPeer() == null) {
            ComponentPeer peer = ((WToolkit) Toolkit.getDefaultToolkit()).createWPageDialog(this);
            setPeer(peer);
        }
        super.addNotify();
    }
}
Also used : Container(java.awt.Container) ComponentPeer(java.awt.peer.ComponentPeer)

Example 100 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)

Aggregations

Container (java.awt.Container)206 JPanel (javax.swing.JPanel)63 JLabel (javax.swing.JLabel)61 JButton (javax.swing.JButton)53 JScrollPane (javax.swing.JScrollPane)51 BoxLayout (javax.swing.BoxLayout)47 FlowLayout (java.awt.FlowLayout)45 ActionEvent (java.awt.event.ActionEvent)38 BorderLayout (java.awt.BorderLayout)36 Dimension (java.awt.Dimension)33 ActionListener (java.awt.event.ActionListener)26 Component (java.awt.Component)25 JmriJFrame (jmri.util.JmriJFrame)20 JFrame (javax.swing.JFrame)18 Border (javax.swing.border.Border)18 JTextArea (javax.swing.JTextArea)17 JTable (javax.swing.JTable)15 JTextField (javax.swing.JTextField)15 Color (java.awt.Color)13 Point (java.awt.Point)13