[問題] JDialog一問...

看板java作者 (我是宅男~!!)時間19年前 (2006/04/04 01:22), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
底下是一個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)
文章代碼(AID): #14CLc_kR (java)
文章代碼(AID): #14CLc_kR (java)