[問題] JDialog一問...
底下是一個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
推
04/04 01:38, , 1F
04/04 01:38, 1F
※ 編輯: cmenphis 來自: 140.122.37.66 (04/04 03:12)
java 近期熱門文章
PTT數位生活區 即時熱門文章