src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java

Print this page




2525               targetInsets.bottom = topInsets.right;
2526               targetInsets.right = topInsets.top;
2527               break;
2528           case TOP:
2529           default:
2530               targetInsets.top = topInsets.top;
2531               targetInsets.left = topInsets.left;
2532               targetInsets.bottom = topInsets.bottom;
2533               targetInsets.right = topInsets.right;
2534         }
2535     }
2536 
2537     // REMIND(aim,7/29/98): This method should be made
2538     // protected in the next release where
2539     // API changes are allowed
2540     boolean requestFocusForVisibleComponent() {
2541         return SwingUtilities2.tabbedPaneChangeFocusTo(getVisibleComponent());
2542     }
2543 
2544     private static class Actions extends UIAction {
2545         final static String NEXT = "navigateNext";
2546         final static String PREVIOUS = "navigatePrevious";
2547         final static String RIGHT = "navigateRight";
2548         final static String LEFT = "navigateLeft";
2549         final static String UP = "navigateUp";
2550         final static String DOWN = "navigateDown";
2551         final static String PAGE_UP = "navigatePageUp";
2552         final static String PAGE_DOWN = "navigatePageDown";
2553         final static String REQUEST_FOCUS = "requestFocus";
2554         final static String REQUEST_FOCUS_FOR_VISIBLE =
2555                                     "requestFocusForVisibleComponent";
2556         final static String SET_SELECTED = "setSelectedIndex";
2557         final static String SELECT_FOCUSED = "selectTabWithFocus";
2558         final static String SCROLL_FORWARD = "scrollTabsForwardAction";
2559         final static String SCROLL_BACKWARD = "scrollTabsBackwardAction";
2560 
2561         Actions(String key) {
2562             super(key);
2563         }
2564 
2565         public void actionPerformed(ActionEvent e) {
2566             String key = getName();
2567             JTabbedPane pane = (JTabbedPane)e.getSource();
2568             BasicTabbedPaneUI ui = (BasicTabbedPaneUI)BasicLookAndFeel.
2569                        getUIOfType(pane.getUI(), BasicTabbedPaneUI.class);
2570 
2571             if (ui == null) {
2572                 return;
2573             }
2574             if (key == NEXT) {
2575                 ui.navigateSelectedTab(SwingConstants.NEXT);
2576             }
2577             else if (key == PREVIOUS) {
2578                 ui.navigateSelectedTab(SwingConstants.PREVIOUS);
2579             }




2525               targetInsets.bottom = topInsets.right;
2526               targetInsets.right = topInsets.top;
2527               break;
2528           case TOP:
2529           default:
2530               targetInsets.top = topInsets.top;
2531               targetInsets.left = topInsets.left;
2532               targetInsets.bottom = topInsets.bottom;
2533               targetInsets.right = topInsets.right;
2534         }
2535     }
2536 
2537     // REMIND(aim,7/29/98): This method should be made
2538     // protected in the next release where
2539     // API changes are allowed
2540     boolean requestFocusForVisibleComponent() {
2541         return SwingUtilities2.tabbedPaneChangeFocusTo(getVisibleComponent());
2542     }
2543 
2544     private static class Actions extends UIAction {
2545         static final String NEXT = "navigateNext";
2546         static final String PREVIOUS = "navigatePrevious";
2547         static final String RIGHT = "navigateRight";
2548         static final String LEFT = "navigateLeft";
2549         static final String UP = "navigateUp";
2550         static final String DOWN = "navigateDown";
2551         static final String PAGE_UP = "navigatePageUp";
2552         static final String PAGE_DOWN = "navigatePageDown";
2553         static final String REQUEST_FOCUS = "requestFocus";
2554         static final String REQUEST_FOCUS_FOR_VISIBLE =
2555                                     "requestFocusForVisibleComponent";
2556         static final String SET_SELECTED = "setSelectedIndex";
2557         static final String SELECT_FOCUSED = "selectTabWithFocus";
2558         static final String SCROLL_FORWARD = "scrollTabsForwardAction";
2559         static final String SCROLL_BACKWARD = "scrollTabsBackwardAction";
2560 
2561         Actions(String key) {
2562             super(key);
2563         }
2564 
2565         public void actionPerformed(ActionEvent e) {
2566             String key = getName();
2567             JTabbedPane pane = (JTabbedPane)e.getSource();
2568             BasicTabbedPaneUI ui = (BasicTabbedPaneUI)BasicLookAndFeel.
2569                        getUIOfType(pane.getUI(), BasicTabbedPaneUI.class);
2570 
2571             if (ui == null) {
2572                 return;
2573             }
2574             if (key == NEXT) {
2575                 ui.navigateSelectedTab(SwingConstants.NEXT);
2576             }
2577             else if (key == PREVIOUS) {
2578                 ui.navigateSelectedTab(SwingConstants.PREVIOUS);
2579             }