🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19255

Re: How to access parent Frame from Applet?

#19255
From: Greg Dickson
Date: Fri, 20 Feb 1998 00:00
83 lines
3050 bytes
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: <6chpeq$4ae7@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34EB12A6.ED625106@sema4.com> <34EB1E7C.962EFD50@csi.com> <34EB874F.490A86A9@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: "Greg Dickson" <witchy@netserv.net.au>
Subject: Re: How to access parent Frame from Applet?
Date: 1998/02/20
Message-ID: <6chpeq$4ae7@forums.borland.com>
X-Deja-AN: 326650045
Content-Transfer-Encoding: 7bit
References: <34EB12A6.ED625106@sema4.com> <34EB1E7C.962EFD50@csi.com> <34EB874F.490A86A9@sema4.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Organization: None
Newsgroups: borland.public.jbuilder.java.language