Forums Register Login

Sometimes applet doesn't draw some JPanel elements

+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
Cannot run your application because there were some unsatisfied dependencies.
Please look at this FAQ especially the webpage about SSCCEs.
+Pie Number of slices to send: Send
And welcome to JavaRanch
+Pie Number of slices to send: Send
 

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]
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
Thanks Michael.

Serhiy,
Please read this
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
I think I finally manged to solve problem...

The trick is adding

line of code in each function


Thanks everyone who tried to help!!!
+Pie Number of slices to send: Send
> 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.
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
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 ;)
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 6162 times.
Similar Threads
java.lang.OutOfMemoryError: Java heap space
Stamps on an image
problem with load image file
JButton slow response time
Saving an ImageIcon to a file
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:05:50.