Search in sources :

Example 6 with AbstractDocument

use of javax.swing.text.AbstractDocument in project processdash by dtuma.

the class CustomColumnEditor method buildGUI.

private void buildGUI() {
    layout = new GridBagLayout();
    contents = new JPanel(layout);
    GridBagConstraints l = new GridBagConstraints();
    l.gridx = 0;
    l.anchor = GridBagConstraints.EAST;
    l.insets = new Insets(0, 0, 5, 5);
    GridBagConstraints f = new GridBagConstraints();
    f.gridx = 1;
    f.anchor = GridBagConstraints.WEST;
    f.insets = new Insets(0, 0, 5, 0);
    l.gridy = f.gridy = 0;
    add(new JLabel(resources.getString("Column_ID")), l);
    add(columnID = hintField("Column_ID_Hint", 15), f);
    add(columnIDLabel = new JLabel(), f);
    ((AbstractDocument) columnID.getDocument()).setDocumentFilter(new ColumnIDFilter());
    l.gridy = ++f.gridy;
    add(new JLabel(resources.getString("Column_Name")), l);
    add(columnName = hintField("Column_Name_Hint", 15), f);
    l.gridy = ++f.gridy;
    add(new JLabel(resources.getString("Column_Type")), l);
    add(textColumnType = new JComboBox(resources.getStrings("Column_Type_", TEXT_TYPES)), f);
    ++f.gridy;
    add(autocomplete = checkbox("Autocomplete", true), f);
    GridBagConstraints ff = (GridBagConstraints) f.clone();
    ff.fill = GridBagConstraints.HORIZONTAL;
    add(allowedValues = hintField("Values_Hint", 0), ff);
    add(Box.createHorizontalStrut(new JLabel(allowedValues.getHint()).getPreferredSize().width), f);
    ++f.gridy;
    add(multivalued = checkbox("Multivalued", false), f);
    ++f.gridy;
    add(inherited = checkbox("Inherited", true), f);
    ++f.gridy;
    add(syncAsLabel = checkbox("Sync_As_Label", false), f);
    textColumnType.addActionListener(this);
    actionPerformed(null);
}
Also used : JPanel(javax.swing.JPanel) AbstractDocument(javax.swing.text.AbstractDocument) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel)

Example 7 with AbstractDocument

use of javax.swing.text.AbstractDocument in project knime-core by knime.

the class DialogComponentAuthentication method updateNoListener.

private static void updateNoListener(final JTextField txtField, final String text) {
    final AbstractDocument doc = (AbstractDocument) txtField.getDocument();
    DocumentListener[] listeners = doc.getDocumentListeners();
    for (DocumentListener listener : listeners) {
        doc.removeDocumentListener(listener);
    }
    txtField.setText(text);
    for (DocumentListener listener : listeners) {
        doc.addDocumentListener(listener);
    }
}
Also used : AbstractDocument(javax.swing.text.AbstractDocument) DocumentListener(javax.swing.event.DocumentListener)

Aggregations

AbstractDocument (javax.swing.text.AbstractDocument)7 HTMLDocument (javax.swing.text.html.HTMLDocument)3 JPanel (javax.swing.JPanel)2 Document (javax.swing.text.Document)2 Dimension (java.awt.Dimension)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 File (java.io.File)1 IOException (java.io.IOException)1 URL (java.net.URL)1 BoxLayout (javax.swing.BoxLayout)1 JComboBox (javax.swing.JComboBox)1 JLabel (javax.swing.JLabel)1 JTextField (javax.swing.JTextField)1 DocumentListener (javax.swing.event.DocumentListener)1 AbstractElement (javax.swing.text.AbstractDocument.AbstractElement)1 AttributeSet (javax.swing.text.AttributeSet)1