SWING / CATATAN</>↗Swing18 Okt 2010
The example below demonstrates how to change the color of the tabs in JTabbedPane component. The JTabbedPane‘s methods that you can use the change foreground and background color are: setForeground(Color color) for changing the foreground color of all tabs. setBackground(Color color) for changing the background color of all tabs. setForegroundAt(int index, Color color) for changing […]
SWING / CATATAN</>↗Swing18 Okt 2010
When adding a tabs to JTabbedPane you can define the icon for the tabs. This icon will be displayed beside the tab’s title in enable or disable state of the tabs. To make the user interface better you can also define a disabled icon for the tab. This icon will be displayed when the state […]
SWING / CATATAN</>↗Swing17 Okt 2010
The following code snippet demonstrates how to create a JTabbedPane component with image icons attached on their tabs. There are two steps that we need to do to achieve this. First we need to load the image icon and after that we need to attach these icons to the tabs. To create or load an […]
SWING / CATATAN</>↗Swing17 Okt 2010
JTabbedPane component tab layout policy of can be either set to JTabbedPane.SCROLL_TAB_LAYOUT or JTabbedPane.WRAP_TAB_LAYOUT. This layout policy will control the display of the tabs when the tabs cannot be displayed in one go. By the default the layout policy is set to JTabbedPane.WRAP_TAB_LAYOUT. Changing tab layout policy to JTabbedPane.SCROLL_TAB_LAYOUT makes the tabs scrollable. A button […]
SWING / CATATAN</>↗Swing17 Okt 2010
By default, the tabs in a JTabbedPane component is placed on the top. But you can place the tabs on every side of the JTabbedPane component, for example it can be on the top, on the right, on the left or on the bottom of the JTabbedPane. To change the tab placement position you need […]
SWING / CATATAN</>↗Swing16 Okt 2010
In this example you will learn how to detect tab selection changes in a JTabbedPane component. To get notified when a tab is selected you must add a ChangeListener to the JTabbedPane component using the addChangeListener(). This method take an instance of class that implements the ChangeListener interface as its arguments. In this example we […]