Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Transparent components

 
Ivan Kesic
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

i have JPanel with background image. So, i need to put my buttons on panel on the same spot as they are on the background picture, and then make them transparent so it looks like you click on picture and not on a real button. But, if i set opaque on button (btn1.setOpaque(false);) it only shows panel's original color, grey, and not the picture that is drawn on him. How can i fix this?
 
Stephan van Hulst
Bartender
Posts: 6587
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan, take a look at this thread:

http://www.coderanch.com/t/540606/GUI/java/JPanel-Transparent-does-not-work
 
Rob Camick
Ranch Hand
Posts: 2703
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JButton works a little different than other components. You need to use:

 
Darryl Burke
Bartender
Posts: 5155
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


edit Today's not a good day. No responses for nearly 3 hours and this has to happen to me

Hi Rob!
 
Rob Camick
Ranch Hand
Posts: 2703
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl, my old keyboard broke and I got a new one a couple of days ago so I must be typing faster
 
crispy bacon. crispy tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!