// Create a tabbed pane JTabbedPane pane = new JTabbedPane(); // Set the text color for all tabs pane.setForeground(Color.YELLOW); // Set the background color for all tabs pane.setBackground(Color.MAGENTA); // Add a tab String label = "Tab Label"…
There are two ways to set a tool tip on a tab. The first is to specify it when the tab is created; the second way is to set it using JTabbedPane.setToolTipTextAt(). // Create a tabbed pane JTabbedPane pane = new JTabbedPane(); // Add a tab with a too…
The tabs of a tabbed pane can be placed on one of the four edges of its container. By default, when a tabbed pane is created, the tabs are placed on top. // Create a tabbed pane with the tabs on top JTabbedPane pane = new JTabbedPane(); // Get curren…
// To create a tabbed pane, see e828 创建JTabbedPane // Get the index of the currently selected tab int selIndex = pane.getSelectedIndex(); // Select the last tab selIndex = pane.getTabCount()-1; pane.setSelectedIndex(selIndex); Related Examples…