简体   繁体   中英

Change color of JTabbedPane border

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.

在此输入图像描述

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!

Try

nameOfYourComponent.setBorder(BorderFactory.createLineBorder(Color.black, 1));
// the second argument is thickness

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM