Article View: borland.public.jbuilder.java.language
Article #19254Re: How to access parent Frame from Applet?
From: Alex Humphreys
Date: Thu, 19 Feb 1998 00:00
Date: Thu, 19 Feb 1998 00:00
102 lines
4010 bytes
4010 bytes
Um, never mind. I figured it out--I just had to reference the Dialog from
the Applet and not the other way round.
But since you're here anyway, what was the the Dialog method hide() replaced
with?
Thanks again for all your help.
Alex Humphreys wrote:
> I tried doing this and I get the error "Cannot make a static reference to
> a non-static variable my_var". here's more or less what I'm doing.
>
> Dialog created in my_Applet.java. In dialog at one point I say
> my_Applet.my_var = temp_string;
>
> This is where I get the error. I'm probably missing something really
> simple, but what?
>
> Thanks.
>
> Greg Dickson wrote:
>
> > Heres an example
> > Dialog window = new Dialog (this ,"",true);
> > window.label1.setText("Add a New User");
> > window.pack();
> > Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
> > window.setLocation((d.width - window.getSize().width) / 2,
> > (d.height - window.getSize().height) / 2);
> > window.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
> > window.show();
> > String info = "";
> >
> > if (window.doIt){
> > info = window.textField1.getText();
> > }
> >
> > This shows a few things and until you lose the refeance to window you
> > still have access to the public components and variables in window
> > This examlple uses the current frame as the base but you could use
> > Conrad new Frame
> > the issue is focus and scope
> >
> > also in the dialog close button or however ok sets doIt to true
> > cancel sets it to false both buttons then call dispose()
> >
> > Hope this is clear enough
> >
> > Greg Dickson
> > **** Witchcliffe WA
> > * ;) *** witchy@netserv.net.au
> > ***** http:\\www.netserv.net.au\witchy\
> > ************ freelance programing (java & perl) & Linux System
> > Admin
> > "technology is like a bus
> > if it's going where you want to go
> > then you take it
> > otherwise you don't" Renzo Piano
> >
> > Alex Humphreys wrote in message <34EB874F.490A86A9@sema4.com>...
> > |GREAT! Thanks! Now how do I send a variable created in the Dialog
> > box to the
> > |Applet when I'm done with the Dialog box?
> > |
> > |Conrad Hoesle-Kienzlen wrote:
> > |
> > |> Alex,
> > |> there have been code snippets in the ...applet-issues how to get
> > the parent
> > |> frame, but it is not really necessary. You can create a new Dialog
> > with:
> > |> Dialog myDialog = new Dialog(new Frame());
> > |> ...Conrad
> > |>
> > |> Alex Humphreys wrote:
> > |>
> > |> > I have an applet inside a frame inside an application. From the
> > Applet,
> > |> > I am trying to load a dialog box, which requires a reference to
> > the
> > |> > frame. here's how I'm trying to do it:
> > |> >
> > |> > my_Dialog my_Dialog = new my_Dialog(this.getParent());
> > |> > my_Dialog.show();
> > |> >
> > |> > But this gives an error: "Error (598) constructor
> > |> > my_Dialog(java.awt.Container) not found in class rte.my_Dialog."
> > |> >
> > |> > Why is getParent() returning the Container and not the Frame, as
> > I
> > |> > thought it should (this is the phrase that the docs told me to
> > use)?
> > |> > How can i create this Dialog box?
> > |> >
> > |> > Thanks.
> > |> >
> > |> > --Alex
> > |
> > |
> > |
Technical Details
Message-ID:
<34ECC355.8B4B192@sema4.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34EB12A6.ED625106@sema4.com> <34EB1E7C.962EFD50@csi.com> <34EB874F.490A86A9@sema4.com> <6chpeq$4ae7@forums.borland.com> <34ECC207.C022AA00@sema4.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,518e42f1a7b03a9b X-Google-Attributes: gidf74b3,public From: Alex Humphreys <ahumphreys@sema4.com> Subject: Re: How to access parent Frame from Applet? Date: 1998/02/19 Message-ID: <34ECC355.8B4B192@sema4.com> X-Deja-AN: 326758146 Content-Transfer-Encoding: 7bit References: <34EB12A6.ED625106@sema4.com> <34EB1E7C.962EFD50@csi.com> <34EB874F.490A86A9@sema4.com> <6chpeq$4ae7@forums.borland.com> <34ECC207.C022AA00@sema4.com> Content-Type: text/plain; charset=us-ascii Organization: None Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language