Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JtabbedPane transparency

 
Nilton Castro
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Big Moose Guys!
I tried some transparency with JTabbedPane using this:

Color alphaZero = new Color (204,204,204,32); // light gray = 204,204,204; 32 = 1/8 opaque or 7/8 transparent

// The following 2 lines generates a well done semi-transparency in header (tabs) of JTabbedPane
produtoFrm.getjTabbedPane1().setOpaque(false); // tabs (3)
produtoFrm.getjTabbedPane1().setBackground(alphaZero); // this works well, 3 tabs semi-transparents

// But the background of panels still opaque, even trying the following code...
produtoFrm.getjScrollPane2().setOpaque(false);
produtoFrm.getjScrollPane2().getViewport().setBackground(alphaZero);
produtoFrm.getjScrollPane3().setOpaque(false);
produtoFrm.getjScrollPane3().getViewport().setBackground(alphaZero);
produtoFrm.getjScrollPane4().setOpaque(false);
produtoFrm.getjScrollPane4().getViewport().setBackground(alphaZero);

What is wrong or missing? (obs - i don´t use look and feel)
Thank you very much, guys and gals!


Imagem.jpg
[Thumbnail for Imagem.jpg]
This is the visual result of my try...
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't know if it's changed in java 7, but for 6 you would set your own ui (tabbedPane.setUI(...)),
overriding paintContentBorder(...) to do nothing
 
Nilton Castro
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick response. But please, no offense, look down and see my low level. In Portuguese, UI (pronounced OOEE) means OUCH. I'm still pretty new to java, I'm trying very hard but I am ignorant. So if possible, you can stretch the "(...)" so I can understand? No joke, no offense, I'm stupid even.
I really appreciate you expend your time with me, do you have a little bit more? Thank you very much!
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


this will be transparent, so you may need to add an intermediary panel with your semi-transparent background
 
Nilton Castro
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Michael Dunn! I will give a try (don´t forget, UI = OUCH in portuguese).
 
Nilton Castro
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello good Michael Dunn!
The solution you presented yesterday worked very well, as shown in the attached image. I'm learning java from myself and when I understood what "listerners" means and how they work i realized that Java is not just a ordinary language, it is an engine (such as game engines) and it is very close to how an operating system works and this is a huge breakthrough for an ordinary language. So, as I said yesterday, I'm a complete ignorant, trying to learn something ... Until yesterday I thought Java was a beautiful woman from afar and, up close, a wild cat. Today I think Java is a beautiful woman from afar and up close, a beautiful woman too hot.
Thank you for taking your time to help people like me from underground.
imagem1.jpg
[Thumbnail for imagem1.jpg]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic