-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
swing1.1
-
generic
-
generic
-
Verified
JTabbedPane.setBackgroundAt() does not work.
The following application attempts to display one tab out of 5 with
a magenta background. When the app is executed, the tab is displayed with
the default background, and not with the expected magenta background.
The background of the tab is not set to magenta even when it is selected.
==========================================================================
/*
* tabTest.java
* JTabbedPane.setBackgroundAt() does not work
*
*/
import java.awt.*;
import java.awt.event.*;
import java.awt.swing.*;
public class tabTest extends JFrame {
JTabbedPane tabbedPane;
public tabTest()
{
tabbedPane = new JTabbedPane();
for (int i = 0; i < 5; i++)
{
JPanel panel = new JPanel();
panel.add(new JLabel("The tab titled 'Tab2' should have a magenta background, but doesn't."));
tabbedPane.addTab("Tab" + i, panel);
}
tabbedPane.setSelectedIndex(2);
tabbedPane.setBackgroundAt(2,Color.magenta);
tabbedPane.setForegroundAt(1,Color.green);
getContentPane().setLayout(new BorderLayout());
getContentPane().add("Center", tabbedPane);
}
public static void main(String[] args)
{
tabTest frame = new tabTest();
frame.pack();
frame.setSize(500,350);
frame.show();
}
}
- relates to
-
JDK-4110018 Motif L&F: JTabbedPane.setBackgroundAt() does not work
-
- Closed
-