Search in sources :

Example 31 with JTextField

use of javax.swing.JTextField 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 32 with JTextField

use of javax.swing.JTextField 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)

Example 33 with JTextField

use of javax.swing.JTextField in project ACS by ACS-Community.

the class FilterStringPanel method createComponents.

/**
 * Insert the method's description here.
 * Creation date: (2/7/02 11:41:10 AM)
 */
protected void createComponents() {
    SelectionChecked sc = new SelectionChecked();
    notCheck = new JCheckBox("Discard entries matching this filter");
    notCheck.setToolTipText("Keep/discard entries matching this filter");
    add(notCheck, newConstraints(0, 4, 4, 4, 4));
    exactCheck = new JCheckBox("Exact value");
    exactCheck.addItemListener(sc);
    add(exactCheck, newConstraints(1, 4, 4, 0, 4));
    exact = new JTextField();
    add(exact, newConstraints(2, 0, 4, 4, 4));
    regexpCheck = new JCheckBox("Regular expression pattern");
    regexpCheck.addItemListener(sc);
    add(regexpCheck, newConstraints(3, 4, 4, 0, 4));
    regexp = new JTextField();
    add(regexp, newConstraints(4, 0, 4, 4, 4));
}
Also used : JCheckBox(javax.swing.JCheckBox) JTextField(javax.swing.JTextField)

Example 34 with JTextField

use of javax.swing.JTextField in project EnrichmentMapApp by BaderLab.

the class PostAnalysisInputPanel method createNamePanel.

private JPanel createNamePanel() {
    nameText = new JTextField();
    makeSmall(nameText);
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Data Set Name (optional)"));
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(nameText, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(nameText, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GroupLayout(javax.swing.GroupLayout) JTextField(javax.swing.JTextField)

Example 35 with JTextField

use of javax.swing.JTextField in project otapij by FellowTraveler.

the class DatePicker method calculateCalendar.

/**
     * Calculates the days of the month.
     */
private void calculateCalendar() {
    // clear the selected date
    if (null != selectedDay) {
        selectedDay.setBackground(white);
        selectedDay = null;
    }
    // get the first day of the selected year and month
    final GregorianCalendar c = new GregorianCalendar(selectedDate.get(Calendar.YEAR), selectedDate.get(Calendar.MONTH), 1);
    // fix for different locales
    c.setMinimalDaysInFirstWeek(1);
    c.setFirstDayOfWeek(Calendar.SUNDAY);
    // figure out the maximum number of days in the month
    final int maxDay = calculateDaysInMonth(c);
    // figure out the day that should be selected in this month
    // based on the previously selected day and the maximum number
    // of days in the month
    final int selectedDay = Math.min(maxDay, selectedDate.get(Calendar.DATE));
    // clear the days up to the first day of the month
    int dow = c.get(Calendar.DAY_OF_WEEK);
    for (int dd = 0; dd < dow; dd++) {
        daysInMonth[0][dd].setText("");
        daysInMonth[0][dd].setBackground(gray);
    }
    // construct the days in the selected month
    int week;
    do {
        week = c.get(Calendar.WEEK_OF_MONTH);
        dow = c.get(Calendar.DAY_OF_WEEK);
        final JTextField fld = this.daysInMonth[week - 1][dow - 1];
        fld.setText(Integer.toString(c.get(Calendar.DATE)));
        if (selectedDay == c.get(Calendar.DATE)) {
            fld.setBackground(highlight);
            this.selectedDay = fld;
        } else
            fld.setBackground(white);
        if (c.get(Calendar.DATE) >= maxDay)
            break;
        c.add(Calendar.DATE, 1);
    } while (c.get(Calendar.DATE) <= maxDay);
    // clear all the days after the last day of the month
    week--;
    for (int ww = week; ww < daysInMonth.length; ww++) {
        for (int dd = dow; dd < daysInMonth[ww].length; dd++) {
            daysInMonth[ww][dd].setText("");
            daysInMonth[ww][dd].setBackground(gray);
        }
        dow = 0;
    }
    // set the currently selected date
    c.set(Calendar.DATE, selectedDay);
    selectedDate = c;
}
Also used : GregorianCalendar(java.util.GregorianCalendar) JTextField(javax.swing.JTextField)

Aggregations

JTextField (javax.swing.JTextField)450 JLabel (javax.swing.JLabel)270 JPanel (javax.swing.JPanel)236 JButton (javax.swing.JButton)135 BorderLayout (java.awt.BorderLayout)115 GridBagLayout (java.awt.GridBagLayout)94 Insets (java.awt.Insets)94 GridBagConstraints (java.awt.GridBagConstraints)93 Dimension (java.awt.Dimension)91 JCheckBox (javax.swing.JCheckBox)89 ActionEvent (java.awt.event.ActionEvent)84 ActionListener (java.awt.event.ActionListener)75 JScrollPane (javax.swing.JScrollPane)64 BoxLayout (javax.swing.BoxLayout)50 JTextArea (javax.swing.JTextArea)40 FlowLayout (java.awt.FlowLayout)39 JComboBox (javax.swing.JComboBox)39 JRadioButton (javax.swing.JRadioButton)37 ButtonGroup (javax.swing.ButtonGroup)35 JTable (javax.swing.JTable)34