求大神帮我看看哪里出了问题,关于java图形化的问题
最近学习图形化,编了一个注册窗口。可是只能显示一部分其他的都被挡住了。程序代码:
class Register{ //注册界面 Register() { reg = new JFrame("欢迎注册本银行用户"); JLabel namelab = new JLabel("姓名:",JLabel.CENTER); nameText = new JTextField("",25); JLabel agelab = new JLabel("年龄:",JLabel.CENTER); ageText = new JTextField("",25); JLabel sexlab = new JLabel("性别:",JLabel.CENTER); sexText = new JTextField("",25); JLabel worklab = new JLabel("职业:",JLabel.CENTER); workText = new JTextField("",25); JLabel addresslab = new JLabel("住址:",JLabel.CENTER); addressText = new JTextField("",25); JLabel tellab = new JLabel("联系电话:",JLabel.CENTER); telText = new JTextField("",25); JLabel IDcardlab = new JLabel("身份证号:",JLabel.CENTER); IDcardText = new JTextField("",25); JPanel userPanel = new JPanel(); userPanel.add(namelab); userPanel.add(nameText); userPanel.add(agelab); userPanel.add(ageText); userPanel.add(sexlab); userPanel.add(sexText); userPanel.add(worklab); userPanel.add(workText); userPanel.add(addresslab); userPanel.add(addressText); userPanel.add(tellab); userPanel.add(telText); userPanel.add(IDcardlab); userPanel.add(IDcardText); JButton ok = new JButton("确认"); JButton no = new JButton("取消"); ok.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ } }); no.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ reg.dispose(); } }); JPanel buttonPanel = new JPanel(); buttonPanel.add(ok); buttonPanel.add(no); reg.setLayout(new GridLayout(7,1)); reg.add(userPanel); //reg.add(buttonPanel); reg.setSize(350,700); reg.setResizable(false); reg.setLocationRelativeTo(null); reg.setVisible(true); } private JFrame reg; private JTextField nameText; //姓名 private JTextField ageText; //年龄 private JTextField sexText; //性别 private JTextField workText; //职业 private JTextField addressText; //地址 private JTextField telText; //联系电话 private JTextField IDcardText; //身份证号 }