Example #1
0
    public void setEnabled(boolean b) {
      super.setEnabled(b);

      setEditable(b);

      final TextAreaPainter thePainter = getPainter();

      // JEditTextArea has a MouseListener that calls requestFocus
      // without checking isRequestFocusEnabled, so there is no way to
      // stop the text area from receiving focus due to a mouse click.
      // We can't use setCaretVisible(false) to make the caret
      // invisible as it is set true by the JEditTextArea focus
      // handler. Paint it invisibly instead.
      thePainter.setCaretColor(b ? m_enabledCaretColour : Colours.GREY);
      thePainter.setBackground(b ? m_enabledBackground : Colours.GREY);
      thePainter.setLineHighlightEnabled(b);

      if (!b) {
        transferFocus();
      }

      setRequestFocusEnabled(b);
    }
Example #2
0
 public void actionPerformed(ActionEvent evt) {
   if (focusedComponent != null && focusedComponent.hasFocus()) focusedComponent.blinkCaret();
 }