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

Print this page




 109                              rows * itemHeight + borderHeight);
 110     }
 111 
 112     @Override
 113     public final void setEditable(final boolean editable) {
 114         synchronized (getDelegateLock()) {
 115             getTextComponent().setEditable(editable);
 116         }
 117     }
 118 
 119     @Override
 120     public final String getText() {
 121         synchronized (getDelegateLock()) {
 122             return getTextComponent().getText();
 123         }
 124     }
 125 
 126     @Override
 127     public void setText(final String l) {
 128         synchronized (getDelegateLock()) {






 129             // JTextArea.setText() posts two different events (remove & insert).
 130             // Since we make no differences between text events,
 131             // the document listener has to be disabled while
 132             // JTextArea.setText() is called.
 133             final Document document = getTextComponent().getDocument();
 134             document.removeDocumentListener(this);
 135             getTextComponent().setText(l);
 136             revalidate();
 137             if (firstChangeSkipped) {
 138                 postEvent(new TextEvent(getTarget(),
 139                                         TextEvent.TEXT_VALUE_CHANGED));
 140             }
 141             document.addDocumentListener(this);
 142         }
 143         repaintPeer();
 144     }
 145 
 146     @Override
 147     public final int getSelectionStart() {
 148         synchronized (getDelegateLock()) {




 109                              rows * itemHeight + borderHeight);
 110     }
 111 
 112     @Override
 113     public final void setEditable(final boolean editable) {
 114         synchronized (getDelegateLock()) {
 115             getTextComponent().setEditable(editable);
 116         }
 117     }
 118 
 119     @Override
 120     public final String getText() {
 121         synchronized (getDelegateLock()) {
 122             return getTextComponent().getText();
 123         }
 124     }
 125 
 126     @Override
 127     public void setText(final String l) {
 128         synchronized (getDelegateLock()) {
 129             // Please note that we do not want to post an event
 130             // if TextArea.setText() or TextField.setText() replaces an empty text by an empty text,
 131             // that is, if component's text remains unchanged.
 132             if (l.isEmpty() && getTextComponent().getDocument().getLength() == 0) {
 133                 return;
 134             }
 135             // JTextArea.setText() posts two different events (remove & insert).
 136             // Since we make no differences between text events,
 137             // the document listener has to be disabled while
 138             // JTextArea.setText() is called.
 139             final Document document = getTextComponent().getDocument();
 140             document.removeDocumentListener(this);
 141             getTextComponent().setText(l);
 142             revalidate();
 143             if (firstChangeSkipped) {
 144                 postEvent(new TextEvent(getTarget(),
 145                                         TextEvent.TEXT_VALUE_CHANGED));
 146             }
 147             document.addDocumentListener(this);
 148         }
 149         repaintPeer();
 150     }
 151 
 152     @Override
 153     public final int getSelectionStart() {
 154         synchronized (getDelegateLock()) {