Article View: borland.public.jbuilder.java.language
Article #19086Problem with member visibility/packages
From: Paul Richards
Date: Fri, 13 Mar 1998 00:00
Date: Fri, 13 Mar 1998 00:00
144 lines
3573 bytes
3573 bytes
I'm struggling with visibility and access and would welcome some help.
I have a directory \Mysource containing UIDataClass.java and
BusLogicDataClass.java, and have added 'package Mysource' to each file,
and import statements for each class.
When I try to compile BusLogicDataClass.java I get a list of errors
like so:
"Undefined variable or classname: txtfldName?"
for each of the textfields in UIDataClass.java.
When I try to compile UIDataClass.java I get the following:
".\Mysource\BusLogicDataClass.java: Undefined variable or classname:
txtfldName?
name = txtfldName.getText()?;
^?"
for each textfield.
It's probably something very basic which I'm missing - can anyone spot
the wood for the trees? (summary code below)
TIA
++ *Paul*
++ from Cheltenham, England
++ Fri, 13 Mar 1998 18:44 GMT
++ WinNT build 1381 + SP3
++ http://freespace.virgin.net/paul.richards/
......
/*
* UIDataClass.java
*/
package Mysource;
import java.awt.*;
import Mysource.*;
public class UIDataClass extends Frame {
public UIDataClass() {
super();
setLayout(null);
addNotify();
Insets insets = insets();
// .....
// set up UI buttons, labels, textfields ...
// ....
show();
}
public boolean handleEvent(Event evt) {
// <snip>
}
// Event handlers
<snip>
// End of event handlers
public static void main(String args[]) {
new UIDataClass();
BusLogicDataClass BLDC = new BusLogicDataClass();
}
Label label1;
Label label2;
TextField txtfldName;
Label label3;
TextField txtfldAddr1;
Label label4;
TextField txtfldAddr2;
Label label5;
TextField txtfldAddr3;
Label label6;
TextField txtfldAge;
Label label7;
TextField txtfldMortgage;
Button btnAdd;
Button btnView;
Button btnExit;
// Other methods/variables:
}
/**
* BusLogicDataClass.java
*/
package Mysource;
import Mysource.*;
import java.io.*;
import java.util.*;
public class BusLogicDataClass // class to store data
{
private String name;
private String address1;
private String address2;
private String address3;
private String age;
private String mortgage;
<snip>
{
BusLogicDataClass nameaddress = new BusLogicDataClass();
}
public BusLogicDataClass() // constructor
{
getTxtFields();
setTxtFields();
} // end constructor
void getTxtFields()
{
name = txtfldName.getText();
address2 = txtfldAddr1.getText();
address2 = txtfldAddr2.getText();
address3 = txtfldAddr3.getText();
age = txtfldAge.getText();
mortgage = txtfldMortgage.getText();
}
void setTxtFields()
{
txtfldName.setText("");
txtfldAddr1.setText("");
txtfldAddr2.setText("");
txtfldAddr3.setText("");
txtfldAge.setText("");
txtfldMortgage.setText("");
}
} // end class BusLogicDataClass
Technical Details
Message-ID:
<VA.0000002a.0c5a12e6@p5>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,ea213ab83e1f43a0,start X-Google-Attributes: gidf74b3,public From: Paul Richards <paul.richards@virgin.net> Subject: Problem with member visibility/packages Date: 1998/03/13 Message-ID: <VA.0000002a.0c5a12e6@p5> X-Deja-AN: 333763607 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=iso-8859-1 Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Reply-To: paul.richards@virgin.net Newsgroups: borland.public.jbuilder.java.language