Print this page
4719 Common patchset for jdk1.7 support preparation


  73     bigTimer     = new BigTimer();
  74     smallTimer   = new SmallTimer();
  75     
  76     bigTimer.start();
  77     smallTimer.start();
  78     
  79     plusButton = new DCButton("+");
  80     minusButton = new DCButton("-");
  81 
  82     add(plusButton);
  83     add(minusButton);
  84 
  85     }
  86 
  87     /**
  88      * Ensures that this component is not brought into focus by
  89      * tabbing. This prevents the tab focus from moving in here instead
  90      * of going to a text field.
  91      * @return false always.
  92      */
  93     public boolean isFocusTraversable() {
  94     return false;
  95     }
  96 
  97     /**
  98      * Sets the listener for this tab.
  99      * @param listener the DCListener that needs to be notified when the
 100      * buttons on this panel are pressed.
 101      * @return the old listener
 102      */
 103     public DCListener setListener(DCListener listener) {
 104     DCListener oldListener = this.listener;
 105     this.listener = listener;
 106     return oldListener;
 107     }
 108 
 109     /**
 110      * Removes the listener when it no longer need to be notified.
 111      * @return the old listener
 112      */
 113     public DCListener removeListener() {


 284         DCPanel.this.stopAction();
 285         }
 286     } 
 287 
 288     /**
 289      * The button used by this DCPanel.
 290      */  
 291     private class DCButton extends Button {
 292     public DCButton(String text) {
 293         super(text);
 294         if (text.equals("+"))
 295            addMouseListener(new DCMouseListener(true));
 296         else
 297         addMouseListener(new DCMouseListener(false));
 298     }
 299 
 300     /**
 301      * Make the button non-focus traversable so that it cannot be
 302      * tabbed in to.
 303      */
 304     public boolean isFocusTraversable() {
 305         return false;
 306     }
 307 
 308     } // DCButton
 309 
 310 
 311     /**
 312      * Test method for DCPanel class to see appearance.
 313      */
 314     public static void main(String args[]) {
 315     Frame f = new Frame("Testing DCPanel");
 316     f.add(new DCPanel());
 317     f.setBounds(new Rectangle(100, 100, 100, 100));
 318     f.setVisible(true);
 319     }
 320   
 321 }


  73     bigTimer     = new BigTimer();
  74     smallTimer   = new SmallTimer();
  75     
  76     bigTimer.start();
  77     smallTimer.start();
  78     
  79     plusButton = new DCButton("+");
  80     minusButton = new DCButton("-");
  81 
  82     add(plusButton);
  83     add(minusButton);
  84 
  85     }
  86 
  87     /**
  88      * Ensures that this component is not brought into focus by
  89      * tabbing. This prevents the tab focus from moving in here instead
  90      * of going to a text field.
  91      * @return false always.
  92      */
  93     public boolean isFocusable() {
  94     return false;
  95     }
  96 
  97     /**
  98      * Sets the listener for this tab.
  99      * @param listener the DCListener that needs to be notified when the
 100      * buttons on this panel are pressed.
 101      * @return the old listener
 102      */
 103     public DCListener setListener(DCListener listener) {
 104     DCListener oldListener = this.listener;
 105     this.listener = listener;
 106     return oldListener;
 107     }
 108 
 109     /**
 110      * Removes the listener when it no longer need to be notified.
 111      * @return the old listener
 112      */
 113     public DCListener removeListener() {


 284         DCPanel.this.stopAction();
 285         }
 286     } 
 287 
 288     /**
 289      * The button used by this DCPanel.
 290      */  
 291     private class DCButton extends Button {
 292     public DCButton(String text) {
 293         super(text);
 294         if (text.equals("+"))
 295            addMouseListener(new DCMouseListener(true));
 296         else
 297         addMouseListener(new DCMouseListener(false));
 298     }
 299 
 300     /**
 301      * Make the button non-focus traversable so that it cannot be
 302      * tabbed in to.
 303      */
 304     public boolean isFocusable() {
 305         return false;
 306     }
 307 
 308     } // DCButton
 309 
 310 
 311     /**
 312      * Test method for DCPanel class to see appearance.
 313      */
 314     public static void main(String args[]) {
 315     Frame f = new Frame("Testing DCPanel");
 316     f.add(new DCPanel());
 317     f.setBounds(new Rectangle(100, 100, 100, 100));
 318     f.setVisible(true);
 319     }
 320   
 321 }