Java Code Examples for javax.swing.text.JTextComponent#setDocument()
The following examples show how to use
javax.swing.text.JTextComponent#setDocument() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertiesTableCellEditor.java From netbeans with Apache License 2.0 | 5 votes |
/** Constructs a PropertiesTableCellEditor that uses a text field. * @param tf a JTextField object ... * @param commentComponent * @param valueComponent * @param valueLabel * @param listener */ public PropertiesTableCellEditor(JTextField tf, final JTextComponent commentComponent, final JTextComponent valueComponent, final JLabel valueLabel, DocumentListener listener) { super(tf); // Number of clicks needed to edit an editable cell. this.clickCountToStart = 1; this.listener = listener; this.valueComponent = valueComponent; this.commentComponent = commentComponent; valueComponent.setDocument(tf.getDocument()); this.delegate = new PropertiesEditorDelegate(commentComponent, valueComponent, valueLabel); ((JTextField)editorComponent).addActionListener(delegate); settings = TableViewSettings.getDefault(); }