• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what is happening, iam unable to see

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi buddies here is my question,waiting for the solution

JFrame window created from within another JFrame window starts as a new Process?
Yes/No
plz provide me the solution as early as possible

class OuterFrame extends JFrame
{
OuterFrame()
{
JFrame internalframe=new JFrame();
internalframe.setSize(800,800);
internalframe.show();
}
}


does internalframe created above with in the Outerframe starts as a new process?
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by a "new process". Do you mean a new thread?

Creating new JFrames does not create new threads. However Swing automatically process all events in the EventDispatchThread, that means that if you create your new JFrame from an event handler, then it will be created by the EventDispatchThread.

Case 1: The first frame created by the main thread


In this case the JFrame is created by the main thread, if another frames are created in the JFrame constructor, they will be created by the main thread, unless you use SwingUtilities.invokeLater().

Case 3: You explicitly create your Frames in the EventDispatchThread


In this case the main method is being executed by the main thread, then I explicitly ask that the new JFrame be created in the EventDispatchThread.

Case 3: The JFrame is created from an event


In this case, as the new JFrame is create from a event, it will be create by the EventDispathThread.

Case 3: The JFrame is created from another thread



In this case the JFrame will be created by a new thread.


In all the cases, no matter which thread creates the new JFrame. All events will be processed by the EventDispatchThread.

New Threads, apart from the EventDispatchThread, are not spawned on the creation of a new JFrame.

Now, although the EventDispatchThread is created once, it is used for the event processing, not for the creation of the JFrame itself.

I hope this helps.

Regards,
Edwin Dalorzo

[ April 06, 2006: Message edited by: Edwin Dalorzo ]
[ April 06, 2006: Message edited by: Edwin Dalorzo ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have a Swing forum for this type of problem. Moving there.
 
NareshAnkuskani Kumar
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank u edwin for u r kind reply. Now that i got some partial answer now i have to look after what is an event dispatch thread?
 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic