Article View: borland.public.jbuilder.java.swing
Article #12216Re: Accessing components in other Frames..
From: Gavin Cassidy
Date: Mon, 15 Feb 1999 00:00
Date: Mon, 15 Feb 1999 00:00
46 lines
1652 bytes
1652 bytes
Yeah Anne, I had this problem myself. All you have to do is when you
first introduce components e.g.
TextField TextField 1;
declare it outside of the constructor class, at the top, as a static
variable. That is:
public class CDRequestFrame extends MyBasicFrame
{
Label label1 = new Label();
XYLayout xYLayout1 = new XYLayout();
Button button1 = new Button();
List list1 = new List();
Label label2 = new Label();
/**
These are all displayed at the top, allowing me to access the values
elsewhere. If this doesn't work, stick the word static before them.
public CDRequestFrame()
{
try
{
jbInit();
}
catch (Exception e)
{
e.printStackTrace();
}
}
etc.etc.
Anne Nortcliffe wrote:
> i'm attempting to enter the values of various text fields from other
> frames into a jTable..
>
> however I keep getting the following error message on attempting to do
> this;
>
> cannot make static reference to non-static variable ........
>
> Any Ideas? thanks in advance
>
> Anne
Technical Details
Message-ID:
<36C81A4A.548AD33A@apion-tss.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36C06960.B69AB1A9@sheffield.ac.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,9e86f8ae628295cd X-Google-Attributes: gid111d45,public From: Gavin Cassidy <g.cassidy@apion-tss.com> Subject: Re: Accessing components in other Frames.. Date: 1999/02/15 Message-ID: <36C81A4A.548AD33A@apion-tss.com> X-Deja-AN: 444572150 Content-Transfer-Encoding: 7bit References: <36C06960.B69AB1A9@sheffield.ac.uk> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Apion Mime-Version: 1.0 Reply-To: g.cassidy@apion-tss.com Newsgroups: borland.public.jbuilder.java.swing