Search in sources :

Example 61 with Dimension

use of java.awt.Dimension in project ACS by ACS-Community.

the class XmlComponentGui method wrapWithFrame.

private JFrame wrapWithFrame(JPanel jpanel) {
    JFrame jframe;
    jframe = new JFrame("XmlComponent's GUI");
    jframe.getContentPane().add(jpanel);
    // termination behav.
    jframe.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    // position the frame in the middle of the screen
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int width = (int) screenSize.getWidth();
    int height = (int) screenSize.getHeight();
    width = (width >= 600 ? 600 : width);
    height = (height >= 400 ? 400 : height);
    jframe.setSize(width, height);
    jframe.setLocation((int) (screenSize.getWidth() - width) / 2, (int) (screenSize.getHeight() - height) / 2);
    return jframe;
}
Also used : JFrame(javax.swing.JFrame) Dimension(java.awt.Dimension)

Example 62 with Dimension

use of java.awt.Dimension in project ACS by ACS-Community.

the class JDynAct method buildWindow.

/** Build the GUI
	 *
	 */
private void buildWindow() {
    Container rootCnt = getContentPane();
    rootCnt.setLayout(new BorderLayout());
    // The container with labels and combo boxes
    Container firstCnt = new Container();
    firstCnt.setLayout(new GridLayout(4, 2));
    firstCnt.add(new JLabel("Name"));
    nameCB = new JComboBox();
    nameCB.setEditable(true);
    nameCB.addItem("*");
    nameCB.addItem("PIPPO");
    nameCB.addItem("PLUTO");
    firstCnt.add(nameCB);
    firstCnt.add(new JLabel("IDL interface"));
    idlCB = new JComboBox();
    idlCB.addItem("*");
    idlCB.addItem("IDL:alma/acsexmplLamp/Lamp:1.0");
    idlCB.addItem("IDL:alma/MOUNT_ACS/Mount:1.0");
    idlCB.addItem("IDL:alma/demo/HelloDemo:1.0");
    idlCB.setEditable(true);
    firstCnt.add(idlCB);
    firstCnt.add(new JLabel("Implementation"));
    implCB = new JComboBox();
    implCB.addItem("*");
    implCB.addItem("acsexmplLampImpl");
    implCB.addItem("acsexmplMountImpl");
    implCB.addItem("alma.demo.HelloDemoImpl.HelloDemoHelper");
    implCB.addItem("demoImpl.HelloDemo");
    implCB.addItem("acsexmplHelloWorldClient");
    implCB.setEditable(true);
    firstCnt.add(implCB);
    firstCnt.add(new JLabel("Container"));
    containerCB = new JComboBox();
    containerCB.addItem("*");
    containerCB.addItem("bilboContainer");
    containerCB.addItem("frodoContainer");
    containerCB.addItem("aragornContainer");
    containerCB.setEditable(true);
    firstCnt.add(containerCB);
    // The container with the activate button
    Container secondCnt = new Container();
    secondCnt.setLayout(new FlowLayout());
    JButton activateB = new JButton("Activate");
    activateB.addActionListener(this);
    secondCnt.add(activateB, "Center");
    // The container with activated container
    MyTableModel tableModel = new MyTableModel();
    activatedT = new JTable(tableModel);
    activatedT.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = activatedT.getSelectionModel();
    JScrollPane scrollP = new JScrollPane(activatedT);
    activatedT.setPreferredScrollableViewportSize(new Dimension(400, 90));
    MyCellRendererr cellR = new MyCellRendererr();
    TableColumnModel tcm = activatedT.getColumnModel();
    TableColumn tc = tcm.getColumn(2);
    tc.setCellRenderer(cellR);
    MyCellEditor cellE = new MyCellEditor(this);
    tc.setCellEditor(cellE);
    Container thirdCnt = new Container();
    thirdCnt.setLayout(new FlowLayout());
    thirdCnt.add(scrollP, "North");
    // Add the container to the main container
    rootCnt.add(firstCnt, "North");
    rootCnt.add(secondCnt, "Center");
    rootCnt.add(thirdCnt, "South");
}
Also used : JScrollPane(javax.swing.JScrollPane) FlowLayout(java.awt.FlowLayout) JComboBox(javax.swing.JComboBox) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) ListSelectionModel(javax.swing.ListSelectionModel) TableColumnModel(javax.swing.table.TableColumnModel) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn) Container(java.awt.Container) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable)

Example 63 with Dimension

use of java.awt.Dimension in project ACS by ACS-Community.

the class ScriptFilter method getFilterComponentTextField.

/**
	 * This method initializes filterComponentTextField
	 * @return javax.swing.JTextField
	 */
private JTextField getFilterComponentTextField() {
    if (filterComponentTextField == null) {
        Dimension d = new Dimension(100, 19);
        filterComponentTextField = new JTextField();
        filterComponentTextField.setPreferredSize(d);
        filterComponentTextField.setToolTipText("Write a word to find a particular component.");
        //filterComponentTextField.setSize(d);
        filterComponentTextField.setMinimumSize(d);
        filterComponentTextField.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
        filterComponentTextField.setHorizontalAlignment(JTextField.LEFT);
        filterComponentTextField.getDocument().addDocumentListener(new DocumentListener() {

            public void applyFilter() {
                int total = compList.length;
                String text = filterComponentTextField.getText();
                if (!filterComponentTextField.getText().isEmpty()) {
                    ComponentComboBox.removeAllItems();
                    for (int i = 0; i < total; i++) {
                        if (compList[i].contains(text)) {
                            ComponentComboBox.addItem(compList[i]);
                        }
                    }
                    ComponentComboBox.hidePopup();
                    ComponentComboBox.showPopup();
                } else {
                    ComponentComboBox.hidePopup();
                    ComponentComboBox.removeAllItems();
                    for (int j = 0; j < total; j++) {
                        ComponentComboBox.addItem(compList[j]);
                    }
                }
                if (ComponentComboBox.getItemCount() == 0) {
                    PropertyComboBox.removeAllItems();
                }
            }

            public void changedUpdate(DocumentEvent e) {
            }

            public void insertUpdate(DocumentEvent e) {
                applyFilter();
            }

            public void removeUpdate(DocumentEvent e) {
                applyFilter();
            }
        });
    }
    return filterComponentTextField;
}
Also used : DocumentListener(javax.swing.event.DocumentListener) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) DocumentEvent(javax.swing.event.DocumentEvent)

Example 64 with Dimension

use of java.awt.Dimension in project ACS by ACS-Community.

the class ScriptFilter method getPropertyComboBox.

/**
	 * This method initializes PropertyComboBox
	 * @return javax.swing.JComboBox
	 */
private JComboBox getPropertyComboBox() {
    if (PropertyComboBox == null) {
        PropertyComboBox = new JComboBox();
        PropertyComboBox.setPreferredSize(new Dimension(320, 24));
    //PropertyComboBox.setSize(PropertyComboBox.getPreferredSize());
    }
    return PropertyComboBox;
}
Also used : JComboBox(javax.swing.JComboBox) Dimension(java.awt.Dimension)

Example 65 with Dimension

use of java.awt.Dimension in project ACS by ACS-Community.

the class ScriptFilter method getFilterPropertyTextField.

/**
	 * This method initializes filterPropertyTextField
	 * @return javax.swing.JTextField
	 */
private JTextField getFilterPropertyTextField() {
    if (filterPropertyTextField == null) {
        Dimension d = new Dimension(100, 19);
        filterPropertyTextField = new JTextField();
        filterPropertyTextField.setPreferredSize(d);
        filterPropertyTextField.setToolTipText("Write a word to find a particular property.");
        //filterPropertyTextField.setSize(d);
        filterPropertyTextField.setMinimumSize(d);
        filterPropertyTextField.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
        filterPropertyTextField.setHorizontalAlignment(JTextField.LEFT);
        filterPropertyTextField.getDocument().addDocumentListener(new DocumentListener() {

            public void applyFilter() {
                String item = (String) ComponentComboBox.getSelectedItem();
                int i = -1;
                for (int j = 0; j < compList.length; j++) {
                    if (compList[j].compareTo(item) == 0) {
                        i = j;
                        break;
                    }
                }
                if (i == -1) {
                    PropertyComboBox.removeAll();
                    return;
                }
                int total = propList.get(i).size();
                String text = filterPropertyTextField.getText();
                PropertyComboBox.removeAllItems();
                for (int j = 0; j < total; j++) {
                    PropertyComboBox.addItem(propList.get(i).get(j).toString());
                }
                PropertyComboBox.showPopup();
                if (!filterPropertyTextField.getText().isEmpty()) {
                    PropertyComboBox.removeAllItems();
                    for (int j = 0; j < total; j++) {
                        if (propList.get(i).get(j).toString().contains(text)) {
                            PropertyComboBox.addItem(propList.get(i).get(j).toString());
                        }
                    }
                } else {
                    PropertyComboBox.hidePopup();
                }
            }

            public void changedUpdate(DocumentEvent e) {
            }

            public void insertUpdate(DocumentEvent e) {
                applyFilter();
            }

            public void removeUpdate(DocumentEvent e) {
                applyFilter();
            }
        });
    }
    return filterPropertyTextField;
}
Also used : DocumentListener(javax.swing.event.DocumentListener) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) DocumentEvent(javax.swing.event.DocumentEvent)

Aggregations

Dimension (java.awt.Dimension)4003 JPanel (javax.swing.JPanel)1091 JLabel (javax.swing.JLabel)742 Point (java.awt.Point)683 JButton (javax.swing.JButton)671 ActionEvent (java.awt.event.ActionEvent)644 ActionListener (java.awt.event.ActionListener)583 JScrollPane (javax.swing.JScrollPane)558 BorderLayout (java.awt.BorderLayout)492 Insets (java.awt.Insets)411 BoxLayout (javax.swing.BoxLayout)334 GridBagLayout (java.awt.GridBagLayout)312 GridBagConstraints (java.awt.GridBagConstraints)266 FlowLayout (java.awt.FlowLayout)242 JTextField (javax.swing.JTextField)235 ImageIcon (javax.swing.ImageIcon)216 Component (java.awt.Component)215 Color (java.awt.Color)205 ChangeEvent (javax.swing.event.ChangeEvent)200 ChangeListener (javax.swing.event.ChangeListener)198