121 setFont(font);
122
123 // set the text of this object to the text of its target
124 setTextImpl(target.getText()); //?? should this be setText
125
126 int start = target.getSelectionStart();
127 int end = target.getSelectionEnd();
128 // Fix for 5100200
129 // Restoring Motif behaviour
130 // Since the end position of the selected text can be greater then the length of the text,
131 // so we should set caret to max position of the text
132 setCaretPosition(Math.min(end, text.length()));
133 if (end > start) {
134 // Should be called after setText() and setCaretPosition()
135 select(start, end);
136 }
137 setEditable(target.isEditable());
138 setScrollBarVisibility();
139 // After this line we should not change the component's text
140 firstChangeSkipped = true;
141 }
142
143 @Override
144 public void dispose() {
145 XToolkit.specialPeerMap.remove(jtext);
146 // visible caret has a timer thread which must be stopped
147 jtext.getCaret().setVisible(false);
148 jtext.removeNotify();
149 textPane.removeNotify();
150 super.dispose();
151 }
152
153 /*
154 * The method overrides one from XComponentPeer
155 * If ignoreSubComponents=={@code true} it calls super.
156 * If ignoreSubComponents=={@code false} it uses the XTextArea machinery
157 * to change cursor appropriately. In particular it changes the cursor to
158 * default if over scrollbars.
159 */
160 @Override
161 public void pSetCursor(Cursor cursor, boolean ignoreSubComponents) {
162 if (ignoreSubComponents ||
163 javaMouseEventHandler == null) {
164 super.pSetCursor(cursor, true);
165 return;
166 }
167
168 Point cursorPos = new Point();
169 ((XGlobalCursorManager)XGlobalCursorManager.getCursorManager()).getCursorPos(cursorPos);
|
121 setFont(font);
122
123 // set the text of this object to the text of its target
124 setTextImpl(target.getText()); //?? should this be setText
125
126 int start = target.getSelectionStart();
127 int end = target.getSelectionEnd();
128 // Fix for 5100200
129 // Restoring Motif behaviour
130 // Since the end position of the selected text can be greater then the length of the text,
131 // so we should set caret to max position of the text
132 setCaretPosition(Math.min(end, text.length()));
133 if (end > start) {
134 // Should be called after setText() and setCaretPosition()
135 select(start, end);
136 }
137 setEditable(target.isEditable());
138 setScrollBarVisibility();
139 // After this line we should not change the component's text
140 firstChangeSkipped = true;
141 compAccessor.setPeer(textPane, this);
142 }
143
144 @Override
145 public void dispose() {
146 XToolkit.specialPeerMap.remove(jtext);
147 // visible caret has a timer thread which must be stopped
148 jtext.getCaret().setVisible(false);
149 jtext.removeNotify();
150 super.dispose();
151 }
152
153 /*
154 * The method overrides one from XComponentPeer
155 * If ignoreSubComponents=={@code true} it calls super.
156 * If ignoreSubComponents=={@code false} it uses the XTextArea machinery
157 * to change cursor appropriately. In particular it changes the cursor to
158 * default if over scrollbars.
159 */
160 @Override
161 public void pSetCursor(Cursor cursor, boolean ignoreSubComponents) {
162 if (ignoreSubComponents ||
163 javaMouseEventHandler == null) {
164 super.pSetCursor(cursor, true);
165 return;
166 }
167
168 Point cursorPos = new Point();
169 ((XGlobalCursorManager)XGlobalCursorManager.getCursorManager()).getCursorPos(cursorPos);
|