下面列出了javax.swing.JTabbedPane#setFocusable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void initComponents() {
tabbedPane = new JTabbedPane();
tabbedPane.setFocusable(false);
for (int i = 0; i < panels.size(); i++) {
PropertiesPanel panel = panels.get(i);
PropertiesProvider provider = groups.get(i).get(0);
ScrollableContainer c = new ScrollableContainer(panel);
c.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
c.setViewportBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
categories.put(provider.getPropertiesCategory(), tabbedPane.getTabCount());
tabbedPane.addTab(provider.getPropertiesName(), null, c,
provider.getPropertiesDescription());
}
setLayout(new BorderLayout());
add(tabbedPane, BorderLayout.CENTER);
}
/**
* 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;
}