Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #11478 > unrolled thread
| Started by | simplicity <stella_pigeon@live.ca> |
|---|---|
| First post | 2012-01-18 15:05 -0800 |
| Last post | 2012-01-20 08:31 -0800 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.lang.java.programmer
Applet and parent browser simplicity <stella_pigeon@live.ca> - 2012-01-18 15:05 -0800
Re: Applet and parent browser Arne Vajhøj <arne@vajhoej.dk> - 2012-01-18 20:52 -0500
Re: Applet and parent browser simplicity <stella_pigeon@live.ca> - 2012-01-19 08:48 -0800
Re: Applet and parent browser simplicity <stella_pigeon@live.ca> - 2012-01-19 14:58 -0800
Re: Applet and parent browser Roedy Green <see_website@mindprod.com.invalid> - 2012-01-23 18:29 -0800
Re: Applet and parent browser Roedy Green <see_website@mindprod.com.invalid> - 2012-01-20 08:31 -0800
| From | simplicity <stella_pigeon@live.ca> |
|---|---|
| Date | 2012-01-18 15:05 -0800 |
| Subject | Applet and parent browser |
| Message-ID | <935e02a3-a6b5-4325-8938-0bb41c1c2832@3g2000pbd.googlegroups.com> |
Folks Is it possible to get the reference to browser window which contains the applet? I tried Window win = (Window)this.getParent() but I do not know what it really returns. I tried to verify what the above might be by looking at win.getName(). I am getting "frame0" while the browser window name is "<document.title> - Windows Internet Explorer".
[toc] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-01-18 20:52 -0500 |
| Message-ID | <4f177767$0$285$14726298@news.sunsite.dk> |
| In reply to | #11478 |
On 1/18/2012 6:05 PM, simplicity wrote:
> Is it possible to get the reference to browser window which contains
> the applet?
>
> I tried Window win = (Window)this.getParent() but I do not know what
> it really returns.
>
> I tried to verify what the above might be by looking at win.getName().
> I am getting "frame0" while the browser window name is
> "<document.title> - Windows Internet Explorer".
Try:
JSObject window = JSObject.getWindow(this);
to get out in the browser and window.gtMember("title") for actually
getting the title.
Untested!
Arne
[toc] | [prev] | [next] | [standalone]
| From | simplicity <stella_pigeon@live.ca> |
|---|---|
| Date | 2012-01-19 08:48 -0800 |
| Message-ID | <66a0a1b0-e7cb-42f8-b83f-57322e778324@y5g2000pbk.googlegroups.com> |
| In reply to | #11486 |
On Jan 18, 6:52 pm, Arne Vajhøj <a...@vajhoej.dk> wrote:
> On 1/18/2012 6:05 PM, simplicity wrote:
>
> > Is it possible to get the reference to browser window which contains
> > the applet?
>
> > I tried Window win = (Window)this.getParent() but I do not know what
> > it really returns.
>
> > I tried to verify what the above might be by looking at win.getName().
> > I am getting "frame0" while the browser window name is
> > "<document.title> - Windows Internet Explorer".
>
> Try:
>
> JSObject window = JSObject.getWindow(this);
>
> to get out in the browser and window.gtMember("title") for actually
> getting the title.
>
> Untested!
>
> Arne
Did not work. According to the documentation JSObject.getMember
returns equivalent to javascript this.name. I tried it and it yields
null.
However, the title is not what I need. As I mentioned in the original
email, I need my applet to obtain the reference to the parent window
(the browser). I need it to feed the specific API which will register
the application with the hardware and allow me to pass the hardware
events to the applet. This API takes the top level window as a
parameter
It is easy for a standalone application - just pass JFrame to API. I
need the equivalent of this when the application runs inside the
browser.
[toc] | [prev] | [next] | [standalone]
| From | simplicity <stella_pigeon@live.ca> |
|---|---|
| Date | 2012-01-19 14:58 -0800 |
| Message-ID | <dcf2168a-ce01-4922-909c-4506a4281817@a8g2000pbi.googlegroups.com> |
| In reply to | #11486 |
On Jan 18, 6:52 pm, Arne Vajhøj <a...@vajhoej.dk> wrote:
> On 1/18/2012 6:05 PM, simplicity wrote:
>
> > Is it possible to get the reference to browser window which contains
> > the applet?
>
> > I tried Window win = (Window)this.getParent() but I do not know what
> > it really returns.
>
> > I tried to verify what the above might be by looking at win.getName().
> > I am getting "frame0" while the browser window name is
> > "<document.title> - Windows Internet Explorer".
>
> Try:
>
> JSObject window = JSObject.getWindow(this);
>
> to get out in the browser and window.gtMember("title") for actually
> getting the title.
>
> Untested!
>
> Arne
Window title is not what I need. I just mentioned it because I thought
that checking it may be used as a form of debugging.
What I need is the reference to parent window (which is a browser) to
be available in the applet the which is running inside it. I need this
to hook up with the hardware which requires the top level window to be
registered.
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2012-01-23 18:29 -0800 |
| Message-ID | <si5sh71qj01nhufrkliv680mfqtib6fmh7@4ax.com> |
| In reply to | #11504 |
On Thu, 19 Jan 2012 14:58:56 -0800 (PST), simplicity
<stella_pigeon@live.ca> wrote, quoted or indirectly quoted someone who
said :
>Window title is not what I need. I just mentioned it because I thought
>that checking it may be used as a form of debugging.
what you might need is
/**
* find Frame/JFrame enclosing a
Component/Container/Dialog/Applet... Returns null if can't find one.
* Useful when you need to pass the enclosing Frame to to a
JDialog constructor.
*
* @return Frame, will be typically not be a literal Frame, but a
* javax.swing.JFrame, sun.applet.AppletViewer, class
sun.plugin2.main.client.PluginEmbeddedFrame (For JApplet)
*/
public static Frame getParentFrame( Component child )
{
Container c = child.getParent();
while ( c != null )
{
if ( c instanceof Frame )
{
return ( Frame ) c;
}
c = c.getParent();
}
return null;
}
--
Roedy Green Canadian Mind Products
http://mindprod.com
One of the most useful comments you can put in a program is
"If you change this, remember to change ?XXX? too".
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2012-01-20 08:31 -0800 |
| Message-ID | <ctkgh713b1vsolnuma341qig0sdt82u364@4ax.com> |
| In reply to | #11478 |
On Wed, 18 Jan 2012 15:05:36 -0800 (PST), simplicity <stella_pigeon@live.ca> wrote, quoted or indirectly quoted someone who said : >Is it possible to get the reference to browser window which contains >the applet? if you want to start peeking outside the Applet you need DOM. Document Object Model. see http://mindprod.com/jgloss/dom.html -- Roedy Green Canadian Mind Products http://mindprod.com One of the most useful comments you can put in a program is "If you change this, remember to change ?XXX? too".
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web