• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sometimes applet doesn't draw some JPanel elements  RSS feed

 
Serhiy Boychenko
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello people,
I have some problem with my code where I'm not able to discover where is the problem.
I have JLabel with an image and JTextField with background image, sometimes window is correctly drawn, sometimes it only draws Text Field.
Anybody can help me with finding problem?



Thanks for any help!
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cannot run your application because there were some unsatisfied dependencies.
Please look at this FAQ especially the webpage about SSCCEs.
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to JavaRanch
 
Serhiy Boychenko
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Cannot run your application because there were some unsatisfied dependencies.
Please look at this FAQ especially the webpage about SSCCEs.


This is probably because 2 images missing, if it's possible I'll attach.

test.png is an image for JTextField's background(I'm not able to attach this one, because of limits)
test2.png is an image for JLabel background..

I tried to run it and it runs on ym pc..

And thank you for help and welcome ;)

test2.PNG
[Thumbnail for test2.PNG]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
was the problem resolved here?

http://forums.sun.com/thread.jspa?threadID=5406265&tstart=0
 
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
Thanks Michael.

Serhiy,
Please read this
 
Serhiy Boychenko
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No the problem still persists.

I have read carefully, next time I'll keep in mind.
Sorry if I'm breaking the main rule, I'll try not to do so.

Basicly I have tried to run the program in my firend's MAC and all elements are cortrectly displayed, but on my PC they are not.. Probably the problem consists in JVM or JDK I'm using on my machine.
 
Serhiy Boychenko
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I finally manged to solve problem...

The trick is adding

line of code in each function


Thanks everyone who tried to help!!!
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Sorry if I'm breaking the main rule, I'll try not to do so.

It's not really a rule, you're free to post wherever you like.

Just remember that many regulars here are also regulars on other sites,
and posts from known cross-posters are generally ignored, even if the
problem has a simple solution.
 
Serhiy Boychenko
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> Sorry if I'm breaking the main rule, I'll try not to do so.

It's not really a rule, you're free to post wherever you like.

Just remember that many regulars here are also regulars on other sites,
and posts from known cross-posters are generally ignored, even if the
problem has a simple solution.


I hope I will not get tagged ;)
It's a nice lesson for next time asking questions.
 
Rob Spoor
Sheriff
Posts: 20902
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Serhiy Boychenko wrote:I think I finally manged to solve problem...

The trick is adding

line of code in each function

That shouldn't be necessary. In fact, if you call super.repaint() from paintComponent, you will cause infinite repainting (or probably a StackOverFlowError). repaint(), through some steps, calls paintComponent, which again calls repaint(), etc.
 
Rob Camick
Ranch Hand
Posts: 2756
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That shouldn't be necessary. In fact, if you call super.repaint() from paintComponent, you will cause infinite repainting


Which has already beeen suggested along with other suggestions in the other posting, which is why I continue to ignore this posting since the OP doesn't bother to update it when suggestions are made.
 
Serhiy Boychenko
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have already figured that... Thanks anyways.

The solution is in this peace of code, just fr future reference if someone will need:


And sorry again for multi posting... This is a good lesson I have passed and wil not repeat.

Thanks everyone who tried to help and helped me to integrate in CodeRanch community ;)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!