110 setBackground(background);
111
112 if (!target.isBackgroundSet()) {
113 // This is a way to set the background color of the TextArea
114 // without calling setBackground - go through accessor
115 compAccessor.setBackground(target, background);
116 }
117 if (!target.isForegroundSet()) {
118 target.setForeground(SystemColor.textText);
119 }
120
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();
|
110 setBackground(background);
111
112 if (!target.isBackgroundSet()) {
113 // This is a way to set the background color of the TextArea
114 // without calling setBackground - go through accessor
115 compAccessor.setBackground(target, background);
116 }
117 if (!target.isForegroundSet()) {
118 target.setForeground(SystemColor.textText);
119 }
120
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 than 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();
|