protected void installListeners() { super.installListeners(); handler = new AquaFocusHandler(); final JTextComponent c = getComponent(); c.addFocusListener(handler); c.addPropertyChangeListener(handler); LookAndFeel.installProperty(c, "opaque", UIManager.getBoolean(getPropertyPrefix() + "opaque")); AquaUtilControlSize.addSizePropertyListener(c); AquaTextFieldSearch.installSearchFieldListener(c); }
/** * Create a line number component for a text component. * * @param argComponent the related text component * @param argMinimumDisplayDigits the number of digits used to calculate the minimum width of the * component. */ public TextLineNumber(JTextComponent argComponent, int argMinimumDisplayDigits) { component = argComponent; setFont(argComponent.getFont()); setBorderGap(5); setCurrentLineForeground(Color.RED); setDigitAlignment(RIGHT); setMinimumDisplayDigits(argMinimumDisplayDigits); argComponent.getDocument().addDocumentListener(this); argComponent.addCaretListener(this); argComponent.addPropertyChangeListener("font", this); }
@Override public void install(final JTextComponent c) { super.install(c); isMultiLineEditor = c instanceof JTextArea || c instanceof JEditorPane; c.addPropertyChangeListener(this); }