aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JtabbedPane transparency Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JtabbedPane transparency" Watch "JtabbedPane transparency" New topic
Author

JtabbedPane transparency

Nilton Castro
Greenhorn

Joined: Dec 15, 2012
Posts: 12
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!





[Thumbnail for Imagem.jpg]

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
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

Joined: Dec 15, 2012
Posts: 12
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

Joined: Jun 09, 2003
Posts: 4632


this will be transparent, so you may need to add an intermediary panel with your semi-transparent background
Nilton Castro
Greenhorn

Joined: Dec 15, 2012
Posts: 12
Thank you very much Michael Dunn! I will give a try (don´t forget, UI = OUCH in portuguese).
Nilton Castro
Greenhorn

Joined: Dec 15, 2012
Posts: 12
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.


[Thumbnail for imagem1.jpg]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JtabbedPane transparency