This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

image in glassPane  RSS feed

 
Agapios Hartzoulakis
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Here is my problem. I've made a glassPane extending JPanel which overrides a JFrame and blocks all the key/mouse events. What I want to do is to set an image to be displayed in the glassPane while it is visible. I've tried all the other components(JTextField, JLabel etc) and are been displayed just fine expept one. Guess what! The one that I want to use , an image! So my question is: Is something special with the image? How can I implement what I want?
Thanks a lot
 
Ko Wey
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thougt I understood a few things about swing, but after reading

"...I've made a glassPane extending JPanel which overrides a JFrame..."

I am not so sure!
With impatience I wait for a reply of one of the ranch-hands!
 
Rob Spoor
Sheriff
Posts: 21087
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you add the image? Using an ImageIcon and JLabel, or some other way?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post code! This works for me. Notice that you may have to explicitly reset
your glasspane to be visible after you add it.
 
Agapios Hartzoulakis
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry if I wasn't quite clear.I didn't mean to make you forget what you already know!
Well, I'm using a class gor the glassPane that I found in another site and it works just fine for me except from the detail with the image.
The class is:

in the constructor of the main frame


I guess I have to change the paint method so that my image to be shown (the image is in the same folder as the rest of the .java files)
I hope to be more clear this time.
Thanks in advance
 
Agapios Hartzoulakis
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At last I found my error by reading some other topics. Thanks anyway
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!