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

Print this page




 107         final int itemHeight = (fm != null) ? fm.getHeight() : 10;
 108         return new Dimension(columns * charWidth + borderWidth,
 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() {




 107         final int itemHeight = (fm != null) ? fm.getHeight() : 10;
 108         return new Dimension(columns * charWidth + borderWidth,
 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 final 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() {