Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

I am unable to see the fields inside my frame

 
Greenhorn
Posts: 29
Android Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 3323
86
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 29
Android Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic