4

I'm trying to change the color of the default blue-gray border on my JTabbedPane. You can see the border circled in the image below.

enter image description here

I want to make this a dark gray color. I've tried using the following UIManager properties (which result in the UI in the image above):

UIManager.put("TabbedPane.background", Color.decode(Colors.FACE_BG));
UIManager.put("TabbedPane.foreground", Color.decode(Colors.FONT_WHITE));
UIManager.put("TabbedPane.opaque", true); 
UIManager.put("TabbedPane.selected", Color.decode(Colors.TABLE_SELECTION));
UIManager.put("TabbedPane.border", BorderFactory.createLineBorder(Color.decode(Colors.DARK_GRAY), 1));

How do I achieve this? Thanks!

petehallw
  • 1,014
  • 6
  • 21
  • 49
  • I have looked into the sources of methods [MetalTabbedPaneUI.installDefaults()](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/swing/plaf/metal/MetalTabbedPaneUI.java#79) and [BasicTabbedPaneUI.installDefaults()](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/swing/plaf/basic/BasicTabbedPaneUI.java#358) From that I guess the relevant UI-color-property for you is `"TabbedPane.borderHightlightColor"`. – Thomas Fritsch Jan 10 '17 at 13:08
  • Thanks for looking into it. I added that property with my `DARK_GRAY` color constant - still the same result unfortunately! – petehallw Jan 10 '17 at 13:11

1 Answers1

-1

Try

nameOfYourComponent.setBorder(BorderFactory.createLineBorder(Color.black, 1));
// the second argument is thickness
Dave2e
  • 22,192
  • 18
  • 42
  • 50
monochroumme
  • 41
  • 1
  • 7