1.建议修改的代码:
public class Jiemian extends JFrame { 23 24 private JPanel contentPane; 25 26 27 private JTextField username; 28 private JTextField email; 29 private JPasswordField password; 30 private JLabel man;
意见:这个类的名字太过随意,可能有时候让人不理解
修改如下:
22 public class interface extends JFrame { 23 24 private JPanel contentPane; 25 26 27 private JTextField username; 28 private JTextField email; 29 private JPasswordField password; 30 private JLabel man;
2.建议修改的代码:
150 switch (n) { 151 case 0: 152 JOptionPane.showMessageDialog(button_1, 153 "用户名:" + name1 + "\n" + "性别:" xb + "\n" + "电子邮件:" mail + "\n" + "爱好:" + role1); 154 } 155 } 156 157 } 158 });
意见:大括号的位置随意摆放,凌乱
修改如下:
150 switch (n) { 151 case 0: 152 JOptionPane.showMessageDialog(button_1, 153 "用户名:" + name1 + "\n" + "性别:" xb + "\n" + "电子邮件:" mail + "\n" + "爱好:" + role1); 154 } 155 } 156 157 } 158 });
3.建议修改的代码:
switch (n) { 151 case 0: 152 JOptionPane.showMessageDialog(button_1, 153 "用户名:" + name1 + "\n" + "性别:" xb + "\n" + "电子邮件:" mail + "\n" + "爱好:" + role1); 154 } 155 } 156
意见:行的长度,缩进有问题,看着不舒服,还有符号也漏掉了
修改如下:
switch (n) { 151 case 0: 152 JOptionPane.showMessageDialog(button_1, 153 "用户名:" + name1 + "\n" + "性别:" + xb + "\n" + "电子邮件:" + mail + "\n" + "爱好:" + role1); 154 } 155 } 156
时间: 2024-10-13 22:57:12