🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to share data between classes in an app.

#20019
From: Greg Hamer
Date: Mon, 03 Nov 1997 00:00
42 lines
1737 bytes
Add some methods to your dialog class to return the data.
In your frame class you would

MyDialog dlg = new MyDialog(frame,"dialog title",true);
String answer = dlg.getAnswer();

where getAnswer is a public method that you define in MyDialog.
Note that the dialogs dispose() method just relases the windows
resources; the instance of the dialog class will still be there until
nobody references it anymore.


Martin wrote:

>  Hi Java people,
>
>  Can someone help me with my problem. I do not know how to share
> information
>  between, for example say a dialog- and a frame class .
>
>  Example:
>
>  Let say that my application consists of frame class and dialog class.
> I
>  want to do a calculation in my frameclass but first the user must
> give the
>  variable a value. This variable belong to the dialog class and I must
> have
>  it returned to my frame class. How do I manage that? It must be some
> kind
>  of return statement (parameterlist?) or something like that or is it
> possible to define
>  global and local variables ? Coding examples are welcome!
>
>  Another question: Is it possible to define a function procedure in
> Java as
>  in the C-language (or Delphi/Pascal)?
>
>  Best Regards,
>
>  Martin Lindgren
Technical Details
Message-ID: <345E5984.10981959@borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <01bce8ab$2eb385a0$bcf8c6c3@FOO.telia.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,59b022adfc377dbf,start
X-Google-Attributes: gidf74b3,public
From: Greg Hamer <ghamer@borland.com>
Subject: Re: How to share data between classes in an app.
Date: 1997/11/03
Message-ID: <345E5984.10981959@borland.com>
X-Deja-AN: 286843333
References: <01bce8ab$2eb385a0$bcf8c6c3@FOO.telia.com>
X-Priority: 3 (Normal)
Organization: None
Newsgroups: borland.public.jbuilder.java.language