public?void?make()?{
????????JLabel?Name,?ID;
????????JTextField?NameText,?IDText;
????????
????????frame2?=?new?JDialog(frame,"新建列表",true);
????????frame2.setLayout(null);
????????frame2.setBounds(0,?0,?400,?500);
????????frame2.setLocationRelativeTo(null);
????????frame2.setVisible(true);
????????frame2.setResizable(true);
????????Name?=?new?JLabel("姓名");
????????Name.setBounds(50,?50,?50,?50);
????????NameText?=?new?JTextField();
????????NameText.setBounds(50,?50,?50,?50);
????????
????????ID?=?new?JLabel("姓名");
????????ID.setBounds(200,?10,?50,?50);
????????IDText?=?new?JTextField();
????????IDText.setBounds(230,?25,?120,?25);
????????Container?container?=?frame2.getContentPane();
????????frame2.add(Name);
????????frame2.add(NameText);
????????frame2.add(ID);
????????frame2.add(IDText);
????????
????????frame2.addWindowListener(new?WindowAdapter()?{
????????????public?void?windowClosing(WindowEvent?e)?{
????????????????
????????????????frame2.setVisible(false);
????????????}
????????});
????}我寫(xiě)的控件可以在JFrame顯示,無(wú)法加到JDialog里顯示
1 回答

Ddion
TA貢獻(xiàn)14條經(jīng)驗(yàn) 獲得超2個(gè)贊
現(xiàn)在已經(jīng)沒(méi)人用java寫(xiě)圖形界面了,沒(méi)必要去學(xué)了
添加回答
舉報(bào)
0/150
提交
取消