Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

what is happening, iam unable to see  RSS feed

 
NareshAnkuskani Kumar
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • 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?
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • 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 ]
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!