Java Code Examples for javax.swing.JTabbedPane#getUI()
The following examples show how to use
javax.swing.JTabbedPane#getUI() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(ActionEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); if (pane != null && (pane.getUI() instanceof CloseTabPaneUI)) { CloseTabPaneUI ui = (CloseTabPaneUI) pane.getUI(); String command = e.getActionCommand(); if (command != null && command.length() > 0) { int mnemonic = e.getActionCommand().charAt(0); if (mnemonic >= 'a' && mnemonic <= 'z') { mnemonic -= ('a' - 'A'); } Integer index = ui.mnemonicToIndexMap.get(new Integer(mnemonic)); if (index != null && pane.isEnabledAt(index.intValue())) { pane.setSelectedIndex(index.intValue()); } } } }
Example 2
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); CloseTabPaneUI ui = (CloseTabPaneUI) pane.getUI(); int tabPlacement = pane.getTabPlacement(); if (tabPlacement == TOP || tabPlacement == BOTTOM) { ui.navigateSelectedTab(WEST); } else { ui.navigateSelectedTab(NORTH); } }
Example 3
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); CloseTabPaneUI ui = (CloseTabPaneUI) pane.getUI(); int tabPlacement = pane.getTabPlacement(); if (tabPlacement == TOP || tabPlacement == BOTTOM) { ui.navigateSelectedTab(EAST); } else { ui.navigateSelectedTab(SOUTH); } }
Example 4
Source File: SwingClientGUI.java From stendhal with GNU General Public License v2.0 | 5 votes |
/** * Create the left side panel of the client. * * @return A component containing the components left of the game screen */ private JComponent createLeftPanel(StendhalClient client) { minimap = new MapPanelController(client); final StatsPanelController stats = StatsPanelController.get(); final BuddyPanelController buddies = BuddyPanelController.get(); ScrolledViewport buddyScroll = new ScrolledViewport((JComponent) buddies.getComponent()); buddyScroll.setScrollingSpeed(SCROLLING_SPEED); final JComponent buddyPane = buddyScroll.getComponent(); buddyPane.setBorder(null); final JComponent leftColumn = SBoxLayout.createContainer(SBoxLayout.VERTICAL); leftColumn.add(minimap.getComponent(), SLayout.EXPAND_X); leftColumn.add(stats.getComponent(), SLayout.EXPAND_X); // Add a background for the tabs. The column itself has none. JPanel tabBackground = new JPanel(); tabBackground.setBorder(null); tabBackground.setLayout(new SBoxLayout(SBoxLayout.VERTICAL)); JTabbedPane tabs = new JTabbedPane(SwingConstants.BOTTOM); // Adjust the Tab Width, if we can. The default is pretty if there's // space, but in the column there are no pixels to waste. TabbedPaneUI ui = tabs.getUI(); if (ui instanceof StyledTabbedPaneUI) { ((StyledTabbedPaneUI) ui).setTabLabelMargins(1); } tabs.setFocusable(false); tabs.add("Friends", buddyPane); tabs.add("Group", GroupPanelController.get().getComponent()); tabBackground.add(tabs, SBoxLayout.constraint(SLayout.EXPAND_X, SLayout.EXPAND_Y)); leftColumn.add(tabBackground, SBoxLayout.constraint(SLayout.EXPAND_X, SLayout.EXPAND_Y)); return leftColumn; }
Example 5
Source File: JTabbedPaneTabJavaElement.java From marathonv5 with Apache License 2.0 | 4 votes |
private boolean makeTabVisible(JTabbedPane tp, int selectedTab) { validateTab(); if (!(tp.getUI() instanceof BasicTabbedPaneUI)) { try { EventQueueWait.call(tp, "setSelectedIndex", selectedTab); } catch (NoSuchMethodException e) { throw new InvalidElementStateException( "Unable to call setSelectedIndex on JTabbedPane. selectedTab = " + selectedTab, e); } return true; } boolean isVisible = false; int n = tp.getTabCount(); int loopCount = n; Action backward = tp.getActionMap().get("scrollTabsBackwardAction"); Action forward = tp.getActionMap().get("scrollTabsForwardAction"); while (!isVisible && loopCount-- > 0) { int firstVisibleTab = -1, lastVisibleTab = -1; for (int i = 0; i < n; i++) { Rectangle tabBounds = tp.getBoundsAt(i); int tabForCoordinate = tp.getUI().tabForCoordinate(tp, tabBounds.x + tabBounds.width / 2, tabBounds.y + tabBounds.height / 2); if (tabForCoordinate != -1) { if (firstVisibleTab == -1) { firstVisibleTab = tabForCoordinate; } lastVisibleTab = tabForCoordinate; } } isVisible = firstVisibleTab <= selectedTab && selectedTab <= lastVisibleTab; if (isVisible) { continue; } if (selectedTab < firstVisibleTab) { backward.actionPerformed(new ActionEvent(tp, ActionEvent.ACTION_PERFORMED, "")); } else { forward.actionPerformed(new ActionEvent(tp, ActionEvent.ACTION_PERFORMED, "")); } } return isVisible; }
Example 6
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); CloseTabPaneUI ui = (CloseTabPaneUI) pane.getUI(); ui.navigateSelectedTab(EAST); }
Example 7
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); CloseTabPaneUI ui = (CloseTabPaneUI) pane.getUI(); ui.navigateSelectedTab(WEST); }
Example 8
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); CloseTabPaneUI ui = (CloseTabPaneUI) pane.getUI(); ui.navigateSelectedTab(NORTH); }
Example 9
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); CloseTabPaneUI ui = (CloseTabPaneUI) pane.getUI(); ui.navigateSelectedTab(SOUTH); }
Example 10
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); CloseTabPaneUI ui = (CloseTabPaneUI) pane.getUI(); ui.navigateSelectedTab(NEXT); }
Example 11
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); CloseTabPaneUI ui = (CloseTabPaneUI) pane.getUI(); ui.navigateSelectedTab(PREVIOUS); }
Example 12
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); CloseTabPaneUI ui = (CloseTabPaneUI) pane.getUI(); ui.requestMyFocusForVisibleComponent(); }