예제 #1
0
 public void actionPerformed(ActionEvent e) {
   KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
   Container container = kfm.getCurrentFocusCycleRoot();
   FocusTraversalPolicy policy = container.getFocusTraversalPolicy();
   if (null == policy) policy = kfm.getDefaultFocusTraversalPolicy();
   Component next =
       moveDown
           ? policy.getComponentAfter(container, PaletteGroupHeader.this)
           : policy.getComponentBefore(container, PaletteGroupHeader.this);
   if (null != next && next instanceof PaletteComponentList) {
     final PaletteComponentList list = (PaletteComponentList) next;
     if (list.getModel().getSize() != 0) {
       list.takeFocusFrom(PaletteGroupHeader.this, list == myComponentList ? 0 : -1);
       return;
     } else {
       next =
           moveDown
               ? policy.getComponentAfter(container, next)
               : policy.getComponentBefore(container, next);
     }
   }
   if (null != next && next instanceof PaletteGroupHeader) {
     next.requestFocus();
   }
 }
 protected void focusNext(JComponent comp) {
   FocusTraversalPolicy policy = FlatWelcomeFrame.this.getFocusTraversalPolicy();
   if (policy != null) {
     Component next = policy.getComponentAfter(FlatWelcomeFrame.this, comp);
     if (next != null) {
       next.requestFocus();
     }
   }
 }
 protected void focusPrev(JComponent comp) {
   FocusTraversalPolicy policy = FlatWelcomeFrame.this.getFocusTraversalPolicy();
   if (policy != null) {
     Component prev = policy.getComponentBefore(FlatWelcomeFrame.this, comp);
     if (prev != null) {
       prev.requestFocus();
     }
   }
 }