You mean like this?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.*;
public class TabColorExample extends JPanel {
public TabColorExample() {
setLayout(new BorderLayout());
UIManager.put("TabbedPane.selected", Color.green);
JTabbedPane tabbedPane = new JTabbedPane();
String tabs[] = {"One", "Two", "Three", "Four"};
Color[] colors = {null, Color.red, null, null};
for (int i=0;i<tabs.length;i++) {
tabbedPane.addTab(tabs[i], createPane(tabs[i]));
tabbedPane.setBackgroundAt(i, colors[i]);
}
tabbedPane.setSelectedIndex(0);
add(tabbedPane, BorderLayout.CENTER);
}
JPanel createPane(String s) {
JPanel p = new JPanel();
p.add(new JLabel(s));
return p;
}
public static void main(String[] args) {
JFrame frame = new JFrame("Tab color Example");
frame.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
System.exit(0);
}
});
frame.getContentPane().add( new TabColorExample() );
frame.setSize( 200, 100 );
frame.setVisible(true);
}
}
Quoting Mike Elliott <[EMAIL PROTECTED]>:
> On Tuesday 23 September 2003 14:44, Roger Lacroix wrote:
> > Have a look at the code at JavaAlmanac:
> > http://www.javaalmanac.com/egs/javax.swing/tabbed_TpTabClr.html?l=find
>
> I did. Unfortunately it doesn't discuss the problem at all. I know how to
> set the background color for any arbitrary tab or, for that matter, for all
> of them, but the selected tab color steadfastly remains gray. Surely this
> can be changed somewhere!
>
> ---
> You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> http://www.sys-con.com/fusetalk
>
---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
http://www.sys-con.com/fusetalk