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); } }); }
我写的控件可以在JFrame显示,无法加到JDialog里显示
Ddion
相关分类