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;
}
});
}
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;
}
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);
}
}
}
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;
}
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();
}
Aggregations