public synchronized void syntheticBind() { boundTextComponent = (JTextComponent) ((PropertyBinding)sourceBinding).getBean(); boundTextComponent.addPropertyChangeListener("document", this); boundTextComponent.getDocument().addDocumentListener(this); }
text.addPropertyChangeListener("document", (PropertyChangeEvent e) -> { Document d1 = (Document)e.getOldValue(); Document d2 = (Document)e.getNewValue();
/** * Create a line number component for a text component. * * @param component the related text component * @param minimumDisplayDigits the number of digits used to calculate * the minimum width of the component */ public TextLineNumber(JTextComponent component, int minimumDisplayDigits) { this.component = component; setFont(component.getFont()); setBorderGap(5); setCurrentLineForeground(Color.RED); setDigitAlignment(RIGHT); setMinimumDisplayDigits(minimumDisplayDigits); component.getDocument().addDocumentListener(this); component.addCaretListener(this); component.addPropertyChangeListener("font", this); }
public void registerTextField( final JTextComponent textField ) { textField.getDocument().addDocumentListener( formTextfieldListener ); textField.addPropertyChangeListener( FormValidator.DOCUMENT_PROPERTY_NAME, formTextfieldListener ); }
/** * Constructor specifying the text component to which the property applies. * * @param textComponent Text component to which the property applies. */ public JTextComponentTextProperty(JTextComponent textComponent) { this.textComponent = textComponent; // Hook to component textComponent.addPropertyChangeListener("document", documentTracker); textComponent.getDocument().addDocumentListener(documentTracker); // Set initial value this.value = textComponent.getText(); }
/** * Listen live or on action performed. */ private void registerListeners(boolean live) { if(live) { document.addDocumentListener(filterHandler); } else { if(textComponent == null) throw new IllegalArgumentException("Non-live filtering supported only for JTextField (document provided)"); if(!(textComponent instanceof JTextField)) throw new IllegalArgumentException("Non-live filtering supported only for JTextField (argument class " + textComponent.getClass().getName() + ")"); JTextField textField = (JTextField) textComponent; textField.addActionListener(filterHandler); } if (textComponent != null) textComponent.addPropertyChangeListener(filterHandler); }
public synchronized void syntheticBind() { boundTextComponent = (JTextComponent) ((PropertyBinding)sourceBinding).getBean(); boundTextComponent.addPropertyChangeListener("document", this); boundTextComponent.getDocument().addDocumentListener(this); }
public synchronized void syntheticBind() { boundTextComponent = (JTextComponent) ((PropertyBinding)sourceBinding).getBean(); boundTextComponent.addPropertyChangeListener("document", this); boundTextComponent.getDocument().addDocumentListener(this); }
public synchronized void syntheticBind() { boundTextComponent = (JTextComponent) ((PropertyBinding)sourceBinding).getBean(); boundTextComponent.addPropertyChangeListener("document", this); boundTextComponent.getDocument().addDocumentListener(this); }
public final static void addUndoRedoSupport(final JTextComponent jtc) { jtc.addPropertyChangeListener("document", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { UndoRedoUtils.registerNewUndoManager(jtc); } }); UndoRedoUtils.registerNewUndoManager(jtc); } public final static JPanel makeEntriesPanel(BeansController<?> beansController,int widthMin,FormElement[] formElements) {
public synchronized void syntheticBind() { boundTextComponent = (JTextComponent) ((PropertyBinding)sourceBinding).getBean(); boundTextComponent.addPropertyChangeListener("document", this); boundTextComponent.getDocument().addDocumentListener(this); }
public FontFallbackListener(final JTextComponent comp) { defaultFont = comp.getFont(); comp.addPropertyChangeListener("font", evt -> { if (evt.getNewValue() != null && !evt.getNewValue().equals(evt.getOldValue())) { defaultFont = (Font) evt.getNewValue(); Document doc = comp.getDocument(); doStyling(doc, 0, doc.getLength()); } }); }
protected void listeningStarted() { cachedText = component.getText(); handler = new Handler(); component.addPropertyChangeListener("document", handler); if (property != PROPERTY_BASE) { component.addFocusListener(handler); } if (property == ON_ACTION_OR_FOCUS_LOST && component instanceof JTextField) { ((JTextField)component).addActionListener(handler); } document = component.getDocument(); installDocumentListener(); }
/** Creates a new instance of ComponentPeer */ private ComponentPeer(JTextComponent pane) { this.pane = pane; // reschedule(); pane.addPropertyChangeListener(this); pane.addCaretListener(this); pane.addAncestorListener(this); document = pane.getDocument(); document.addDocumentListener(this); ancestorAdded(null); }
protected void listeningStarted() { cachedText = component.getText(); handler = new Handler(); component.addPropertyChangeListener("document", handler); if (property != PROPERTY_BASE) { component.addFocusListener(handler); } if ((property == ON_ACTION_OR_FOCUS_LOST) && component instanceof JTextField) { ((JTextField) component).addActionListener(handler); } document = component.getDocument(); installDocumentListener(); }
@Override protected void installListeners () { getComponent ().addFocusListener (this); getComponent ().addPropertyChangeListener (this); }
private void setupWithCaret(Caret caret) { if (caret != null) { textComponent.addFocusListener(this); textComponent.addPropertyChangeListener("editable", this); caretBlinkRate = caret.getBlinkRate(); if (!textComponent.isEditable()) { caret.setBlinkRate(0); } } else { caretBlinkRate = 0; } }
@Override protected void installListeners() { super.installListeners(); getComponent().addFocusListener(this); getComponent().addPropertyChangeListener(this); }
public TextLineNumbersPanel(JTextComponent component, int minimumDisplayDigits, Border border, int borderGap, ALIGNMENT alignment) { this.component = component; setBackground(Color.LIGHT_GRAY); setForeground(Color.black); setCurrentLineForeground(new Color(0,0,255)); setDigitAlignment(alignment); setBorder(border, borderGap); setMinimumDisplayDigits( minimumDisplayDigits); setFont(component.getFont()); component.getDocument().addDocumentListener(this); component.addPropertyChangeListener("font", this); component.addCaretListener(this); }
public void setEnforceVisibilityOnFocusGain(boolean visible) { if (enforceCaretVisibility == visible) { return; } enforceCaretVisibility = visible; if (enforceCaretVisibility) { setupWithCaret(textComponent.getCaret()); textComponent.addPropertyChangeListener("caret", this); } else { removeListenersWithCaret(textComponent.getCaret()); textComponent.removePropertyChangeListener("caret", this); } }