2

I am trying to add tabs in a JTabbedPane. It is displaying the below mentioned white borderline which I am not expecting here as Every color is already set to Black except the white color for the text colors. What I might be missing. enter image description here I am trying to change this class from jitsi project

Here is what I've tried so far.
OS: Ubuntu 19.10: Java Version: 1.8.0_242
Windows 10 Pro: Java Version: 1.8.0_241
I am using default look and feel for this Frame whereas, for my manually created design, it is Nimbus.

Jamshaid
  • 370
  • 2
  • 11
  • 40

1 Answers1

0

The answer for the question heavily depends on the Look and Feel you're using for your application. I can't tell which one you're using by just looking at the screenshot because you modified it a lot and you've left out part of the code in your question that installs it. In case you aren't installing any specific one - you're running the default Look and Feel, which might also be different depending on the OS/JDK versions, if I'm not wrong.

So as @sleepToken already said in the comment - do not post random parts of your code or all of the code, instead post an SSCCE. While sometimes you might think it is unnecessary and/or unrelated - in many cases it is not, and it does help whoever will read and try to answer your question to run the code & debug the issue if necessary.

That being said - I can give a general answer to your question: All component are painted by their respective UI implementation (TabbedPaneUI in this particular case) and in some cases parts of the painting code might not be configurable, for instance some colors or other options might be hard-coded. You can simply look into the source code of the particular UI implementation that your application uses, find the painting code that you want to configure and see if it is actually configurable in the first place.

In case your application uses MetalLookAndFeel - the implementation is MetalTabbedPaneUI. From what I can tell by looking at it's code - it uses colors from TabbedPane.highlight, TabbedPane.borderHightlightColor and TabbedPane.darkShadow UI defaults for the border. Adding custom color for TabbedPane.highlight might fix the issue for you since you didn't mention that you modified that one in your question.

In case it doesn't - I once again recommend posting an SSCCE along with your OS type/version in case you're using a native Look and Feel. Native Look and Feel differs between different JDK versions for different OS version and often uses a highly customized UI implementation that might not be as configurable.

Mikle Garin
  • 10,083
  • 37
  • 59
  • please have a look at the question. I've added the whole class which I've implemented till now – Jamshaid Feb 23 '20 at 17:51
  • Thanks for your suggestions but it doesn't work with that – Jamshaid Feb 23 '20 at 17:52
  • The class you're linking is not an [SSCCE](http://sscce.org/), it contains lots of code unrelated to the problem. Isolate a small example (that contains `JTabbedPane` and changes you've applied so far to the UI defaults) and provide it in your question here. Also don't link to external sites, always put code example containing the issue in your question. – Mikle Garin Feb 24 '20 at 14:48