• Post Reply Bookmark Topic Watch Topic
  • New Topic

Transparent components  RSS feed

 
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
Saloon Keeper
Posts: 6984
110
  • 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: 2756
12
  • 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: 5167
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: 2756
12
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!