Search in sources :

Example 36 with JTextComponent

use of javax.swing.text.JTextComponent in project intellij-plugins by JetBrains.

the class RegistrationForm method setupFormActionsAndLF.

private void setupFormActionsAndLF() {
    myUseExisting.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            boolean useExisting = myUseExisting.isSelected();
            JComponent[] hideableFields = new JComponent[] { myNickname, myNicknameLabel, myFirstName, myFirstNameLabel, myLastName, myLastNameLabel, myPasswordAgain, myPasswordAgainLabel };
            for (JComponent hideableField : hideableFields) {
                hideableField.setVisible(!useExisting);
            }
            Window window = SwingUtilities.getWindowAncestor(myPanel);
            if (window != null) {
                window.pack();
            }
        }
    });
    UIUtil.traverse(myPanel, new UIUtil.TraverseAction() {

        public boolean executeAndContinue(Component c) {
            if (c instanceof JTextComponent) {
                JTextComponent textComponent = (JTextComponent) c;
                textComponent.getDocument().addDocumentListener(new DocumentAdapter() {

                    protected void textChanged(DocumentEvent e) {
                        myErrorLabel.setText(null);
                    }
                });
            }
            return true;
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) DocumentAdapter(com.intellij.ui.DocumentAdapter) ItemListener(java.awt.event.ItemListener) JTextComponent(javax.swing.text.JTextComponent) JTextComponent(javax.swing.text.JTextComponent) DocumentEvent(javax.swing.event.DocumentEvent) UIUtil(jetbrains.communicator.util.UIUtil)

Example 37 with JTextComponent

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

the class DataJTable method prepareEditor.

@Override
public Component prepareEditor(TableCellEditor editor, int row, int column) {
    unwrapQueriedValues = true;
    Component result = super.prepareEditor(editor, row, column);
    unwrapQueriedValues = false;
    if (result != null) {
        // save the value we are editing for undo purposes
        valueBeforeEditing = editor.getCellEditorValue();
        // register ourselves with the UndoList
        UndoList.addCellEditor(this, editor);
    }
    // select all the text in the component (users are used to this)
    if (result instanceof JTextComponent)
        ((JTextComponent) result).selectAll();
    return result;
}
Also used : JTextComponent(javax.swing.text.JTextComponent) Component(java.awt.Component) JTextComponent(javax.swing.text.JTextComponent)

Example 38 with JTextComponent

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

the class AssignedToComboBoxAdaptor method markCurrentWord.

public void markCurrentWord() {
    JTextComponent text = getTextComponent();
    AssignedToDocument doc = (AssignedToDocument) text.getDocument();
    int caretPos = text.getCaretPosition();
    Word w = doc.getWord(caretPos);
    if (w != null) {
        markWord(w);
        if (w.isNumber())
            w = w.prev;
        if (w != null && w.isLetters()) {
            String val = doc.getWordText(w);
            if (!val.equals(getSelectedItemAsString()))
                doc.setSelectedItem(val);
        }
    }
}
Also used : Word(net.sourceforge.processdash.ui.lib.autocomplete.AssignedToDocument.Word) JTextComponent(javax.swing.text.JTextComponent)

Example 39 with JTextComponent

use of javax.swing.text.JTextComponent in project cayenne by apache.

the class CayenneTable method getSelectedTextComponent.

public JTextComponent getSelectedTextComponent() {
    int row = getSelectedRow();
    int column = getSelectedColumn();
    if (row < 0 || column < 0) {
        return null;
    }
    TableCellEditor editor = this.getCellEditor(row, column);
    if (editor instanceof DefaultCellEditor) {
        Component comp = ((DefaultCellEditor) editor).getComponent();
        if (comp instanceof JTextComponent) {
            return (JTextComponent) comp;
        }
    }
    return null;
}
Also used : JTextComponent(javax.swing.text.JTextComponent) TableCellEditor(javax.swing.table.TableCellEditor) JTextComponent(javax.swing.text.JTextComponent) Component(java.awt.Component) DefaultCellEditor(javax.swing.DefaultCellEditor)

Example 40 with JTextComponent

use of javax.swing.text.JTextComponent in project cayenne by apache.

the class DbRelationshipPathComboBoxEditor method initializeCombo.

@Override
protected void initializeCombo(CayenneTableModel model, int row, final JTable table) {
    super.initializeCombo(model, row, table);
    comboBoxPathChooser.setSelectedItem(((ObjRelationshipTableModel) model).getRelationship(row).getDbRelationshipPath());
    enterPressedCount = 0;
    comboBoxPathChooser.setToolTipText("To choose relationship press enter two times.To choose next relationship press dot.");
    JTextComponent textEditor = (JTextComponent) (comboBoxPathChooser).getEditor().getEditorComponent();
    textEditor.addFocusListener(this);
    savePath = this.model.getRelationship(row).getDbRelationshipPath();
}
Also used : ObjRelationshipTableModel(org.apache.cayenne.modeler.editor.ObjRelationshipTableModel) JTextComponent(javax.swing.text.JTextComponent)

Aggregations

JTextComponent (javax.swing.text.JTextComponent)89 NotNull (org.jetbrains.annotations.NotNull)9 Component (java.awt.Component)7 DocumentEvent (javax.swing.event.DocumentEvent)6 DocumentAdapter (com.intellij.ui.DocumentAdapter)5 Disposable (com.intellij.openapi.Disposable)3 JButton (javax.swing.JButton)3 Project (com.intellij.openapi.project.Project)2 GraphicsConfig (com.intellij.openapi.ui.GraphicsConfig)2 FocusEvent (java.awt.event.FocusEvent)2 KeyEvent (java.awt.event.KeyEvent)2 File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Accessible (javax.accessibility.Accessible)2 Action (javax.swing.Action)2 JComboBox (javax.swing.JComboBox)2 JFrame (javax.swing.JFrame)2 JLabel (javax.swing.JLabel)2 JMenuItem (javax.swing.JMenuItem)2