List of usage examples for javax.swing JTabbedPane setBackgroundAt
@BeanProperty(preferred = true, visualUpdate = true, description = "The background color at the specified tab index.") public void setBackgroundAt(int index, Color background)
index to background which can be null, in which case the tab's background color will default to the background color of the tabbedpane. From source file:Main.java
public static void main(String[] argv) throws Exception { JTabbedPane pane = new JTabbedPane(); pane.setForeground(Color.YELLOW); pane.setBackground(Color.MAGENTA); String label = "Tab Label"; pane.addTab(label, new JButton("Button")); int index = pane.getTabCount() - 1; pane.setForegroundAt(index, Color.ORANGE); pane.setBackgroundAt(index, Color.GREEN); }
From source file:TabSample.java
public static void main(String args[]) { JFrame frame = new JFrame("Tabbed Pane Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTabbedPane tabbedPane = new JTabbedPane(); String titles[] = { "General", "Security", "Content", "Connection", "Programs", "Advanced" }; int mnemonic[] = { KeyEvent.VK_G, KeyEvent.VK_S, KeyEvent.VK_C, KeyEvent.VK_O, KeyEvent.VK_P, KeyEvent.VK_A };/* w w w .j a v a2 s . c om*/ for (int i = 0, n = titles.length; i < n; i++) { add(tabbedPane, titles[i], mnemonic[i]); tabbedPane.setBackgroundAt(i, colors[i]); } frame.add(tabbedPane, BorderLayout.CENTER); frame.setSize(400, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTabbedPane pane = new JTabbedPane(); int src = pane.getTabCount() - 1; int dst = 0;//from w ww . j a v a 2 s. c om Component comp = pane.getComponentAt(src); String label = pane.getTitleAt(src); Icon icon = pane.getIconAt(src); Icon iconDis = pane.getDisabledIconAt(src); String tooltip = pane.getToolTipTextAt(src); boolean enabled = pane.isEnabledAt(src); int keycode = pane.getMnemonicAt(src); int mnemonicLoc = pane.getDisplayedMnemonicIndexAt(src); Color fg = pane.getForegroundAt(src); Color bg = pane.getBackgroundAt(src); pane.remove(src); pane.insertTab(label, icon, comp, tooltip, dst); pane.setDisabledIconAt(dst, iconDis); pane.setEnabledAt(dst, enabled); pane.setMnemonicAt(dst, keycode); pane.setDisplayedMnemonicIndexAt(dst, mnemonicLoc); pane.setForegroundAt(dst, fg); pane.setBackgroundAt(dst, bg); }