Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JFrame only shows three borders and no contents

 
Richard Grimmett
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an intermittent problem and has been driving me nuts. My code is running via javaw on Windows 7 and XP. It sits in the background waiting for a barcode to be swiped, and then wakes up and asks a question. The trouble is that sometimes (definitely not always), it shows like this:


The code is:


Initially I though it might because I had another thread running which occasionally put up announcement messages in JFrames. But I have taken this out and the problem still persists.

Can anyone help please?

thanks
Richard
 
Campbell Ritchie
Marshal
Posts: 52632
119
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is something not quite right about creating a Frame in a method. Your Frame should be your top‑level container which appears at the beginning of the program and stays there until you close the app.
Where are you setting the Frame visible?
If you want something which appears and disappears, maybe you want a dialogue window instead.
 
Darryl Burke
Bartender
Posts: 5155
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read and take to heart: Concurrency in Swing. Make sure that all Swing constructors and methods are invoked only on the EDT.

If, after doing that, the problem still persists then post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that we can run to try to find out what else might be wrong.
 
Richard Grimmett
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thank you Darryl. I had not appreciated the significance of this. I have made those changes now. Unfortunately the problem is very intermittent and I have been unable to recreate the problem on my own computer. The code has been running live 24x7 on more than 20 machines for some 9 months now. The client has been complaining for the past few weeks about this problem but it only happens maybe twice per day overall. I am convinced that it has been happenig since installation but the complaints have started since they started using the system seriously.
 
Richard Grimmett
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:There is something not quite right about creating a Frame in a method. Your Frame should be your top‑level container which appears at the beginning of the program and stays there until you close the app.
Where are you setting the Frame visible?


Thank you Campbell. I am going to do some more reading up on this.

R
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!