예제 #1
0
파일: Editor.java 프로젝트: zeph/grinder
    public CustomJEditTextArea(TextAreaDefaults textAreaDefaults) {
      super(textAreaDefaults);

      final TextAreaPainter thePainter = getPainter();
      m_enabledBackground = thePainter.getBackground();
      m_enabledCaretColour = thePainter.getCaretColor();
    }
예제 #2
0
파일: Editor.java 프로젝트: zeph/grinder
    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);
    }