作者cmenphis (我是宅男~!!)
看板java
标题[问题] JDialog一问...
时间Tue Apr 4 01:25:39 2006
底下是一个class 继承JDialog
是写在一个Frame之下的class
让Frame呼叫 login m = new login();
但是...为什麽没办法用呢?
是不是我有哪里写错了?
还是我的呼叫就是错的了...
class login extends JDialog
{
static public final int width = 280;//视窗宽
static public final int height = 350;//视窗高
static public String username ;
private JPanel ContentPanel;
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JPasswordField jPasswordField1 = new JPasswordField();
JTextField jTextField1 = new JTextField();
JButton jButton1 = new JButton();
JButton jButton3 = new JButton();
JLabel jLabel3 = new JLabel();
public login()
{
super();
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setSize(width,height);
this.setVisible(true);
this.getContentPane().setLayout(null);
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
this.setLocation(300,150);
this.setTitle("");
this.setModal(true);
ContentPanel = (JPanel)this.getContentPane();
ContentPanel.setBackground(UIManager.getColor("window"));
ContentPanel.setDoubleBuffered(false);
ContentPanel.add(jTextField1);
ContentPanel.add(jPasswordField1);
ContentPanel.add(jLabel1);
ContentPanel.add(jLabel2);
ContentPanel.add(jButton1);
ContentPanel.add(jButton3);
ContentPanel.add(jLabel3);
}
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.122.37.66
1F:推 PsMonkey:接近作业文,请多注意 04/04 01:38
※ 编辑: cmenphis 来自: 140.122.37.66 (04/04 03:12)