Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

doesn't show picture unless resize main Window  RSS feed

 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there

i have another weird (at least for me) problem.

My program does not display picture unless i resize main window.

here is my actionListener event code:



and this is where i print label


Thanks for any help
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ibrahim yener wrote:

Is that a method you wrote? in what class? what does it do?

It's difficult to even guess at your problem without a SSCCE <- link

In general, every time you add/remove components from an already realized Swing GUI you need to invoke revalidate(0 and repaint().

And since this is about GUIs I shall move it to where the GUI experts hang out.
 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Darryl
Thanks for reply.

Yes, the method named setPlayingCards i wrote.
Besides that method everything works fine as it should be.

I have added contentPane.revalidate(); after read your post but still doesn't work.

Sorry for bothering you guys but i am learning Java about a month for now and we didn't learned GUI(Swing/Awt) yet.
All we know is just Java basics but i want to learn Java ASAP

Anyway, let's turn back to my subject. Shortly revalidate(); didn't work.
 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a screen shot i just made by Photoshop
this is exactly what i want.
Untitled-1.jpg
[Thumbnail for Untitled-1.jpg]
Black Jack Result
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl requested you to post your SSCCE and you post a screenshot? Wow!

Anyway, Darryl has already told you
In general, every time you add/remove components from an already realized Swing GUI you need to invoke revalidate(0 and repaint().


I doubt anyone can help you out beyond this unless your post your SSCCE (<-link; click) code

 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay
i solved the problem. I change revalidate into repaint and whoola!!! problem solved.

Thanks everyone who read my post and esp. Darryl and Maneesh.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!