src/macosx/classes/sun/lwawt/LWTextComponentPeer.java

Print this page




  54 
  55     private volatile boolean firstChangeSkipped;
  56 
  57     LWTextComponentPeer(final T target,
  58                         final PlatformComponent platformComponent) {
  59         super(target, platformComponent);
  60         if (!getTarget().isBackgroundSet()) {
  61             getTarget().setBackground(SystemColor.text);
  62         }
  63     }
  64 
  65     @Override
  66     void initializeImpl() {
  67         super.initializeImpl();
  68         synchronized (getDelegateLock()) {
  69             // This listener should be added before setText().
  70             getTextComponent().getDocument().addDocumentListener(this);
  71         }
  72         setEditable(getTarget().isEditable());
  73         setText(getTarget().getText());

  74         getTarget().addInputMethodListener(this);
  75         final int start = getTarget().getSelectionStart();
  76         final int end = getTarget().getSelectionEnd();
  77         if (end > start) {
  78             select(start, end);
  79         }
  80         setCaretPosition(getTarget().getCaretPosition());
  81         firstChangeSkipped = true;
  82     }
  83 
  84     @Override
  85     protected final void disposeImpl() {
  86         synchronized (getDelegateLock()) {
  87             // visible caret has a timer thread which must be stopped
  88             getTextComponent().getCaret().setVisible(false);
  89         }
  90         super.disposeImpl();
  91     }
  92 
  93     /**
  94      * This method should be called under getDelegateLock().
  95      */
  96     abstract JTextComponent getTextComponent();
  97 
  98     public Dimension getMinimumSize(final int rows, final int columns) {
  99         final Insets insets;
 100         synchronized (getDelegateLock()) {




  54 
  55     private volatile boolean firstChangeSkipped;
  56 
  57     LWTextComponentPeer(final T target,
  58                         final PlatformComponent platformComponent) {
  59         super(target, platformComponent);
  60         if (!getTarget().isBackgroundSet()) {
  61             getTarget().setBackground(SystemColor.text);
  62         }
  63     }
  64 
  65     @Override
  66     void initializeImpl() {
  67         super.initializeImpl();
  68         synchronized (getDelegateLock()) {
  69             // This listener should be added before setText().
  70             getTextComponent().getDocument().addDocumentListener(this);
  71         }
  72         setEditable(getTarget().isEditable());
  73         setText(getTarget().getText());
  74         setCaretPosition(getTarget().getCaretPosition());
  75         getTarget().addInputMethodListener(this);
  76         final int start = getTarget().getSelectionStart();
  77         final int end = getTarget().getSelectionEnd();
  78         if (end > start) {
  79             select(start, end);
  80         }

  81         firstChangeSkipped = true;
  82     }
  83 
  84     @Override
  85     protected final void disposeImpl() {
  86         synchronized (getDelegateLock()) {
  87             // visible caret has a timer thread which must be stopped
  88             getTextComponent().getCaret().setVisible(false);
  89         }
  90         super.disposeImpl();
  91     }
  92 
  93     /**
  94      * This method should be called under getDelegateLock().
  95      */
  96     abstract JTextComponent getTextComponent();
  97 
  98     public Dimension getMinimumSize(final int rows, final int columns) {
  99         final Insets insets;
 100         synchronized (getDelegateLock()) {