|
藍森林 http://www.lslnet.com 2006年6月6日 10:18
請高手指點!謝謝!
import javax.swing.*;
public class Applicant
{
static JFrame frame;
static JPanel panel;
JLabel labelAppID;
JLabel labelAppName;
JLabel labelAppAddress;
JLabel labelAppPosition;
JTextField textAppID;
JTextField textAppName;
JTextField textAppAddress;
JComboBox comboAppPosition;
public static void main(String args[])
{
frame = new JFrame("我的窗口");
Applicant appObject;
appObject = new Applicant();
frame.setVisible(true);
frame.setSize(500,600);
}
public Applicant()
{
panel = new JPanel();
frame.getContentPane().add(panel);
labelAppID = new JLabel("號碼");
labelAppName = new JLabel("名字");
labelAppAddress = new JLabel("地址");
labelAppPosition = new JLabel("職位");
textAppID = new JTextField(5);
textAppName = new JTextField(20);
textAppAddress = new JTextField(30);
String positions[] = {"Manger","Executive",
"Associate"};
comboAppPosition = new JComboBox(positions);
panel.add(labelAppID);
panel.add(textAppID);
panel.add(labelAppName);
panel.add(textAppName);
panel.add(labelAppAddress);
panel.add(textAppAddress);
panel.add(labelAppPosition);
panel.add(comboAppPosition);
}
}
如果方便的話請用另一種方法寫出上面(main函數在最後的那種)這段代碼!謝謝!M |
請高手指點!謝謝!
錯了,不是什麼main函數在最後!清還一種形式,謝謝! |
| |