This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm trying to use a ButtonGroup of JToggleButtons and a CardLayout to simulate the function of a JTabbedPane with a different look & feel. To do that I need to have the selected JToggleButton be the same color as the selected panel in the CardLayout. My problem is this - no matter what I do I can't get the selected JToggleButton to match the panel. I've tried setting the background color in the button to the exact color of the panel and then verifying that the colors are the same RGB color (in this case 204,204,204) but even then the button is darker than the surrounding area. What gives? I've also tried setOpaque(false) to no avail. Any help is appreciated. Thx. Another solution to this problem would be changing the appearance of the tabs in a JTabbed Pane (I'm assuming in the TabbedPaneUI), but I don't know how to do that. If someone has an answer to this I would LOVE to hear it. -Kevin
if you set the JButton to setOpaque(true) it *should* have the same backgound as its parent where its placed. From little experience trying to change the appearance of buttons I think they have some additional color layer. But you could check that simply by reading through the original source. Same for JTabbedPane and its UI class. this should shed some ligth on your question. another solution could be to just use JLabel, Border, and MouseListener (in fact I'd say JButtons aren't anything else?!). cheers
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com