packagechapter1;importjavax.swing.*;importjavax.swing.table.*;importjavax.swing.event.*;importjava.awt.*;importjava.awt.event.*;publicclassCustomextendsJFrame{JLableHeadi...
package chapter1;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class Custom extends JFrame
{
JLable Heading;
JLable labelCustNo;
JLable labelCustName;
JLable labelCustSex;
JLable labelCustAge;
JTextFiled textCustNO;
JTextFiled textCustName;
JComboBox comboCustSex;
JTextField textCustAge;
Customer(){
super("顾客情况");
container con;
con=this.getContentPane();
con.setLayout (new FlowLayout());
labelCustNo=new JLabel("顾客编号");
labelCustName=new JLabel("顾客姓名");
labelCustSex=new JLabel("顾客性别");
labelCustAge=new JLabel("顾客年龄");
textCustNo=new JTextField(20);
textCustName=new JTextField(20);
textCustAge=new JTextField(2);
String Sex[]={"男","女"};
comboCustSex=new JComboBox (Sex);
con.add(labelCustNo);
con.add(textCustNo);
con.add(labelCustName);
con.add(textCustName);
con.add(labelCustSex);
con.add(comboCustSex);
con.add(labelCustAge);
con.add(textCustAge);
setDefaultCloseoperation(EXIT_ON_CLOSE);
setSize(350,250);
this.show();
}
public static void main(String[] args){
class Customer{
Customer cust=new Customer();}
}
}
Custom.java:18:方法声明无效;需要返回类型
Customer(){
展开