how to use a variable from another file of the project
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   youness_moustahib
Posted On:   Monday, August 27, 2001 12:39 AM

i use many files, in my project, i
i use a jtextField, and i want to use its value
to use it in other file of my project
i tried to do
jtextFieldName.getText();
i had a message that jtextFieldName is a variable
not declared; i tried to tape the name of the file
where the jtextFiled is init, but it return me an eroor message

Re: how to use a variable from another file of the project

Posted By:   Dermot_Hennessy  
Posted On:   Monday, August 27, 2001 01:23 AM

Declare your jtextFieldName variable to be public and it will be visible to classes outside the class in which it is initialised.

Better yet, create an accessor method (e.g.
getJtextFieldName()

) which returns the variable instance, and optionally deals with anomalous situations such as where the variable has not yet been initialised or is in some 'improper' state.

Dermot

About | Sitemap | Contact