悟
悟峰
Unregistered / Unconfirmed
GUEST, unregistred user!
編輯環境JCreator,代碼如下:
import javax.swing.*;
public class Demo6 extends Applet {
JPanel panelOjbect;
JLabel custno;
JLabel custname;
JLabel custsex;
JLabel custage;
JTextField textcustno;
JTextField textcustname;
JTextField textcustage;
JComboBox combocustsex;
public void init() {
panelOjbect=new JPanel();
getContentPane().add(panelOjbect);
custno=new JLabel("customer number");
custname=new JLabel("name");
custsex=new JLabel("sex");
custage=new JLabel("age");
textcustno=new JTextField(15);
textcustname=new JTextField(30);
textcustage=new JTextField(2);
String sex[]={"Male","Female"};
combocustsex=new JComboBox(sex);
panelOjbect.add(custno);
panelOjbect.add(textcustno);
panelOjbect.add(custname);
panelOjbect.add(textcustname);
panelOjbect.add(custsex);
panelOjbect.add(combocustsex);
panelOjbect.add(custage);
panelOjbect.add(textcustage);
}
}
出現錯誤提示如下,請各位幫忙解答:--------------------Configuration: demo6 - JDK version 1.3.1_04 <Default>--------------------
C:/Program Files/Xinox Software/JCreator Pro/MyProjects/Helloworld3/variableclass/customer/demo6/Demo6.java:29: cannot resolve symbol
symbol : method getContentPane ()
location: class Demo6
getContentPane().add(panelOjbect);
^
1 error
Process completed.
import javax.swing.*;
public class Demo6 extends Applet {
JPanel panelOjbect;
JLabel custno;
JLabel custname;
JLabel custsex;
JLabel custage;
JTextField textcustno;
JTextField textcustname;
JTextField textcustage;
JComboBox combocustsex;
public void init() {
panelOjbect=new JPanel();
getContentPane().add(panelOjbect);
custno=new JLabel("customer number");
custname=new JLabel("name");
custsex=new JLabel("sex");
custage=new JLabel("age");
textcustno=new JTextField(15);
textcustname=new JTextField(30);
textcustage=new JTextField(2);
String sex[]={"Male","Female"};
combocustsex=new JComboBox(sex);
panelOjbect.add(custno);
panelOjbect.add(textcustno);
panelOjbect.add(custname);
panelOjbect.add(textcustname);
panelOjbect.add(custsex);
panelOjbect.add(combocustsex);
panelOjbect.add(custage);
panelOjbect.add(textcustage);
}
}
出現錯誤提示如下,請各位幫忙解答:--------------------Configuration: demo6 - JDK version 1.3.1_04 <Default>--------------------
C:/Program Files/Xinox Software/JCreator Pro/MyProjects/Helloworld3/variableclass/customer/demo6/Demo6.java:29: cannot resolve symbol
symbol : method getContentPane ()
location: class Demo6
getContentPane().add(panelOjbect);
^
1 error
Process completed.