...
>>>You do not even need to attach it to the 'default'
>>>frame and it should act as you specified.
[quoted text clipped - 10 lines]
> Frame f = Frame.getFrames()[0];
> JOptionPane.showMessageDialog(f, theMessage);
Out of curiosity : What does SwingUtilities.getWindowAncestor(this)
return when invoked from an Applet ? If that does return the frame
that contains the Applet, it would probably be a better idea to
use it as the parent rather than Frame.getFrames()[0] (More
deterministic if getFrames() returns more than one Frame)
> ...or..
>
> JOptionPane.showMessageDialog(null, theMessage);
>
> (Note that neither accepts an applet as an argument.)
Hmm ? Isn't the first argument of the showMessageDialog method a
java.awt.Component ? In which case it should allow an Applet to
be passed as the parentComponent.
BK
Andrew Thompson - 21 Sep 2006 13:11 GMT
....
> > The two ways on offer are..
> >
> > Frame f = Frame.getFrames()[0];
> > JOptionPane.showMessageDialog(f, theMessage);
...
> > JOptionPane.showMessageDialog(null, theMessage);
> >
> > (Note that neither accepts an applet as an argument.)
...
> Hmm ? Isn't the first argument of the showMessageDialog method a
> java.awt.Component ?
LOL! while typing that entire post, I was thinking..
'SOK*, Babu might notice this post and jump in with
accurate details.
* 'SOK translates to 'It is OK'.
...and on the bits I trimmed (shrugs vaguely) - dunno'.
Shall we leave it as 'an exercise for the OP'? ;-)
Andrew T.
Babu Kalakrishnan - 21 Sep 2006 13:52 GMT
> ....
>
[quoted text clipped - 23 lines]
>
> Shall we leave it as 'an exercise for the OP'? ;-)
Haha.. well I hadn't noticed it till I wrote the initial question - I
was really wondering if the SwingUtilities method wouldn't provide you
with the actual Frame that parented the Applet, because getFrames()[0]
seemed so arbitrary.
Anyway good to hear that I'm keeping someone on their toes ;-) Never
realized I had this reputation of "policing" the newsgroup !!
BK
giangiammy - 21 Sep 2006 14:33 GMT
> Out of curiosity : What does SwingUtilities.getWindowAncestor(this)
> return when invoked from an Applet ? If that does return the frame
> that contains the Applet, it would probably be a better idea to
> use it as the parent rather than Frame.getFrames()[0] (More
> deterministic if getFrames() returns more than one Frame)
I tested SwingUtilities.getWindowAncestor(this),
but it did not get me the correct
behavious of the pop up neither in the standalone application
nor in the applet.
> > ...or..
> >
[quoted text clipped - 5 lines]
> java.awt.Component ? In which case it should allow an Applet to
> be passed as the parentComponent.
Yes: I have done in this way: I pass the applet as parent
bye
giammy