Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2008

Tip: Looking for answers? Try searching our database.

Problem in displaying components in JFrame

Thread view: 
snehapshinde@gmail.com - 19 Mar 2008 11:47 GMT
I created a class extending JFrame
I created a frame containing several components
After making it Visible by setVisible(), I have used a timer.
When the timer expires the function returns,
But unless and until the function returns,the components on the frame
are not being displayed..
But I want them to be displayed during the timers time span.
Please Help!
Alex.From.Ohio.Java@gmail.com - 19 Mar 2008 13:04 GMT
On Mar 19, 6:47 am, snehapshi...@gmail.com wrote:
> I created a class extending JFrame
> I created a frame containing several components
[quoted text clipped - 4 lines]
> But I want them to be displayed during the timers time span.
> Please Help!

...After making it Visible by setVisible(), V HERE IT SHOULD BE
VISIBLE V.....

If it's not visible at this particular moment then you have errors in
your code which you had not posted here.

Alex.
http://www.myjavaserver.com/~alexfromohio/
Lew - 19 Mar 2008 13:36 GMT
snehapshi...@gmail.com wrote:
>> I created a class extending JFrame
>> I created a frame containing several components
[quoted text clipped - 4 lines]
>> But I want them to be displayed during the timers time span.
>> Please Help!

Do not run the timer on the Event Dispatch Thread (EDT).

Study Swing concurrency, hard, starting here:
<http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html>

I hypothesize, absent sufficient information from you, that your starting
thread is waiting for the timer, and that you start it from a GUI event
handler, thus awaiting the timer in the EDT.  Nothing else can happen in the
GUI until each action completes, in this case the wait for the time to expire.
 You have to start the timer in a separate, worker thread, and have the
worker thread update the GUI upon completion through invokeLater().

Of course, no one can help you with confidence until you actually tell us what
the problem is.  You have described the overall picture, but given us no hard
data until you provide an example - a simple, self-contained compilable
example of source that evinces your problem.
<http://mindprod.com/jgloss/sscce.html>

Without that we're just pissing in the dark.

Signature

Lew

Alex.From.Ohio.Java@gmail.com - 19 Mar 2008 17:50 GMT
> snehapshi...@gmail.com wrote:
> >> I created a class extending JFrame
[quoted text clipped - 28 lines]
> --
> Lew

Lew:
GUI is running in another thread. That's how it's built.
You can see it with JConsole.
Or simply show current thread from any GUI event.

Alex.
http://www.myjavaserver.com/~alexfromohio/
Lew - 20 Mar 2008 01:32 GMT
>> snehapshi...@gmail.com wrote:
>>>> I created a class extending JFrame
[quoted text clipped - 32 lines]
> You can see it with JConsole.
> Or simply show current thread from any GUI event.

I have no idea what you said.

Meanwhile,
<http://mindprod.com/jgloss/sscce.html>
<http://mindprod.com/jgloss/sscce.html>
<http://mindprod.com/jgloss/sscce.html>

Signature

Lew

Knute Johnson - 20 Mar 2008 04:44 GMT
>>> snehapshi...@gmail.com wrote:
>>>>> I created a class extending JFrame
[quoted text clipped - 41 lines]
> <http://mindprod.com/jgloss/sscce.html>
> <http://mindprod.com/jgloss/sscce.html>

Subtle, I like that.

Signature

Knute Johnson
email s/nospam/linux/

snehapshinde@gmail.com - 20 Mar 2008 07:18 GMT
On Mar 19, 9:50 pm, Alex.From.Ohio.J...@gmail.com wrote:

> > snehapshi...@gmail.com wrote:
> > >> I created a class extending JFrame
[quoted text clipped - 37 lines]
>
> - Show quoted text -

Thanks for the help!
snehapshinde@gmail.com - 20 Mar 2008 07:18 GMT
> snehapshi...@gmail.com wrote:
> >> I created a class extending JFrame
[quoted text clipped - 28 lines]
> --
> Lew

Thanks for the help
I have created a separate threads for GUI and timer and it is working
fine...


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.