< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/LWListPeer.java

Print this page




 285         public void setFont(Font font) {
 286             super.setFont(font);
 287             if (getView() != null) {
 288                 getView().setFont(font);
 289                 LWListPeer.this.revalidate();
 290             }
 291         }
 292 
 293         private final class JListDelegate extends JList<String> {
 294 
 295             JListDelegate() {
 296                 super(model);
 297             }
 298 
 299             @Override
 300             public boolean hasFocus() {
 301                 return getTarget().hasFocus();
 302             }
 303 
 304             @Override

 305             protected void processMouseEvent(final MouseEvent e) {
 306                 super.processMouseEvent(e);
 307                 if (e.getID() == MouseEvent.MOUSE_CLICKED && e.getClickCount() == 2) {
 308                     final int index = locationToIndex(e.getPoint());
 309                     if (0 <= index && index < getModel().getSize()) {
 310                         LWListPeer.this.postEvent(new ActionEvent(getTarget(), ActionEvent.ACTION_PERFORMED,
 311                             getModel().getElementAt(index), e.getWhen(), e.getModifiers()));
 312                     }
 313                 }
 314             }
 315 
 316             @Override

 317             protected void processKeyEvent(final KeyEvent e) {
 318                 super.processKeyEvent(e);
 319                 if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_ENTER) {
 320                     final String selectedValue = getSelectedValue();
 321                     if(selectedValue != null){
 322                         LWListPeer.this.postEvent(new ActionEvent(getTarget(), ActionEvent.ACTION_PERFORMED,
 323                             selectedValue, e.getWhen(), e.getModifiers()));
 324                     }
 325                 }
 326             }
 327 
 328             //Needed for Autoscroller.
 329             @Override
 330             public Point getLocationOnScreen() {
 331                 return LWListPeer.this.getLocationOnScreen();
 332             }
 333         }
 334     }
 335 }


 285         public void setFont(Font font) {
 286             super.setFont(font);
 287             if (getView() != null) {
 288                 getView().setFont(font);
 289                 LWListPeer.this.revalidate();
 290             }
 291         }
 292 
 293         private final class JListDelegate extends JList<String> {
 294 
 295             JListDelegate() {
 296                 super(model);
 297             }
 298 
 299             @Override
 300             public boolean hasFocus() {
 301                 return getTarget().hasFocus();
 302             }
 303 
 304             @Override
 305             @SuppressWarnings("deprecation")
 306             protected void processMouseEvent(final MouseEvent e) {
 307                 super.processMouseEvent(e);
 308                 if (e.getID() == MouseEvent.MOUSE_CLICKED && e.getClickCount() == 2) {
 309                     final int index = locationToIndex(e.getPoint());
 310                     if (0 <= index && index < getModel().getSize()) {
 311                         LWListPeer.this.postEvent(new ActionEvent(getTarget(), ActionEvent.ACTION_PERFORMED,
 312                             getModel().getElementAt(index), e.getWhen(), e.getModifiers()));
 313                     }
 314                 }
 315             }
 316 
 317             @Override
 318             @SuppressWarnings("deprecation")
 319             protected void processKeyEvent(final KeyEvent e) {
 320                 super.processKeyEvent(e);
 321                 if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_ENTER) {
 322                     final String selectedValue = getSelectedValue();
 323                     if(selectedValue != null){
 324                         LWListPeer.this.postEvent(new ActionEvent(getTarget(), ActionEvent.ACTION_PERFORMED,
 325                             selectedValue, e.getWhen(), e.getModifiers()));
 326                     }
 327                 }
 328             }
 329 
 330             //Needed for Autoscroller.
 331             @Override
 332             public Point getLocationOnScreen() {
 333                 return LWListPeer.this.getLocationOnScreen();
 334             }
 335         }
 336     }
 337 }
< prev index next >