< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java

Print this page




 264             xtext.setSelectedTextColor(c);
 265         }
 266         repaintText();
 267     }
 268 
 269     @Override
 270     public void setForeground(Color c) {
 271         foreground = c;
 272         if (xtext != null) {
 273             if (xtext.getForeground() != c) {
 274                 xtext.setForeground(foreground);
 275             }
 276             xtext.setSelectionColor(foreground);
 277             xtext.setCaretColor(foreground);
 278         }
 279         repaintText();
 280     }
 281 
 282     @Override
 283     public void setFont(Font f) {

 284         synchronized (getStateLock()) {
 285             font = f;
 286             if (xtext != null && xtext.getFont() != f) {
 287                 xtext.setFont(font);

 288             }
 289         }

 290         xtext.validate();
 291     }
 292 
 293     /**
 294      * Deselects the highlighted text.
 295      */
 296     public void deselect() {
 297         int selStart=xtext.getSelectionStart();
 298         int selEnd=xtext.getSelectionEnd();
 299         if (selStart != selEnd) {
 300             xtext.select(selStart,selStart);
 301         }
 302     }
 303 
 304     /**
 305      * to be implemented.
 306      * @see java.awt.peer.TextComponentPeer
 307      */
 308     @Override
 309     public int getCaretPosition() {




 264             xtext.setSelectedTextColor(c);
 265         }
 266         repaintText();
 267     }
 268 
 269     @Override
 270     public void setForeground(Color c) {
 271         foreground = c;
 272         if (xtext != null) {
 273             if (xtext.getForeground() != c) {
 274                 xtext.setForeground(foreground);
 275             }
 276             xtext.setSelectionColor(foreground);
 277             xtext.setCaretColor(foreground);
 278         }
 279         repaintText();
 280     }
 281 
 282     @Override
 283     public void setFont(Font f) {
 284         boolean isChanged = false;
 285         synchronized (getStateLock()) {
 286             font = f;
 287             if (xtext != null && xtext.getFont() != f) {
 288                 xtext.setFont(font);
 289                 isChanged = true;
 290             }
 291         }
 292         if (isChanged)
 293             xtext.validate();
 294     }
 295 
 296     /**
 297      * Deselects the highlighted text.
 298      */
 299     public void deselect() {
 300         int selStart=xtext.getSelectionStart();
 301         int selEnd=xtext.getSelectionEnd();
 302         if (selStart != selEnd) {
 303             xtext.select(selStart,selStart);
 304         }
 305     }
 306 
 307     /**
 308      * to be implemented.
 309      * @see java.awt.peer.TextComponentPeer
 310      */
 311     @Override
 312     public int getCaretPosition() {


< prev index next >