This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes I am unable to see the fields inside my frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "I am unable to see the fields inside my frame" Watch "I am unable to see the fields inside my frame" New topic
Author

I am unable to see the fields inside my frame

sampath surineni
Greenhorn

Joined: Apr 02, 2012
Posts: 29

Hi I'm coding an alarm application.
I have a snooze class which gets called when the alarm sounds. It used to work fine before using JMF.But after using JMF I see only the outer frame of my snooze UI.

I tried starting a new thread for the class but got the same result. I'm pasting here code of the classes in which I think the problem is in.

Please help me solve the problem.

IsTime class. Which checks whether it is the time to sound alarm.


Media class which plays song when it is time


Snooze class where the real problem is
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2173
    
  47
If you already have a JFrame displaying your clock you shouldn't be creating new JFrame for your snooze panel, you should be using a JDialog.
Your classes shouldn't extend Thread, they should implement Runnable.
You should call Swing methods like setVisible() on the Event Dispatch Thread.
sampath surineni
Greenhorn

Joined: Apr 02, 2012
Posts: 29

Tony Docherty wrote:If you already have a JFrame displaying your clock you shouldn't be creating new JFrame for your snooze panel, you should be using a JDialog.
Your classes shouldn't extend Thread, they should implement Runnable.
You should call Swing methods like setVisible() on the Event Dispatch Thread.


But Mr.Tony Docherty I was coding this app taking asource code as an example. They did the same thing and it is working there. I tried using runnable but the result is same. I didn't understand what you said by calling Swing methods like setVisible() on the Event Dispatch Thread. But there is a set visible method call in my constructor.

Sorry if I'm being foolish. I'm a beginner and thank you for reply
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2173
    
  47
The first two points are all about good Java coding practices. They are not essential to make it work.
The final point is critical: See the currency in swing tutorial
 
jQuery in Action, 2nd edition
 
subject: I am unable to see the fields inside my frame
 
Similar Threads
How to set time 11:00 PM using Date or GregorianCalendar
find time differnce between to calender
Calendar returns wrong date?
change calendar
displaying time