Java Code Examples for javax.swing.JTabbedPane#setFocusable()

The following examples show how to use javax.swing.JTabbedPane#setFocusable() . 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: PropertiesCustomizer.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 2
Source File: SwingClientGUI.java    From stendhal with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}