java窗口关闭事件代码 java关闭当前窗口打开新窗口( 三 )


getContentPane().add(jLabel_School_logo);
jLabel_School_logo.setBounds(0, 0, 86, 84);
ImageIcon logo=new ImageIcon("img/log.jpg");
jLabel_School_logo.setIcon(logo);
}
{
jLabel_title = new JLabel();
getContentPane().add(jLabel_title);
jLabel_title.setBounds(86, 0, 447, 84);
ImageIcon title=new ImageIcon("img/title.jpg");
jLabel_title.setIcon(title);
}
{
jLabel_user_name = new JLabel();
getContentPane().add(jLabel_user_name);
jLabel_user_name.setText("\u5b66\u53f7\uff1a");
jLabel_user_name.setBounds(155, 131, 51, 31);
jLabel_user_name.setFont(new java.awt.Font("叶根友毛笔行书2.0版",0,12));
}
{
jTextField_user_name = new JTextField();
getContentPane().add(jTextField_user_name);
jTextField_user_name.setBounds(199, 135, 151, 23);
}
{
jLabel_passwd = new JLabel();
getContentPane().add(jLabel_passwd);
jLabel_passwd.setText("\u5bc6\u7801\uff1a");
jLabel_passwd.setBounds(152, 185, 51, 31);
jLabel_passwd.setFont(new java.awt.Font("叶根友毛笔行书2.0版",0,12));
}
{
jPasswordField = new JPasswordField();
getContentPane().add(jPasswordField);
jPasswordField.setBounds(199, 189, 151, 23);
}
{
jButton_login = new JButton();
getContentPane().add(jButton_login);
jButton_login.setText("\u767b\u5f55");
jButton_login.setBounds(199, 235, 68, 23);
jButton_login.setFont(new java.awt.Font("叶根友毛笔行书2.0版",0,12));
}
{
jButton_reg = new JButton();
getContentPane().add(jButton_reg);
jButton_reg.setText("\u6ce8\u518c");
jButton_reg.setBounds(282, 235, 68, 23);
jButton_reg.setFont(new java.awt.Font("叶根友毛笔行书2.0版",0,12));
jButton_reg.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
jButton_regMouseClicked(evt);
}
});
}
{
ComboBoxModel jComboBox1Model =
new DefaultComboBoxModel(
new String[] { "学生/老师登录", "管理员登录" });
jComboBox1 = new JComboBox();
getContentPane().add(jComboBox1);
jComboBox1.setModel(jComboBox1Model);
jComboBox1.setBounds(199, 90, 152, 23);
jComboBox1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jComboBox1ActionPerformed(evt);
}
});
}
pack();
this.setSize(549, 334);
} catch (Exception e) {
//add your error handling code here
e.printStackTrace();
}
}
private void jComboBox1ActionPerformed(ActionEvent evt) {
if(jComboBox1.getSelectedIndex()==0)
{
jLabel_user_name.setText("学号java窗口关闭事件代码:");
}
else
{
jLabel_user_name.setText("帐号java窗口关闭事件代码:");
}
}
private void jButton_regMouseClicked(MouseEvent evt) {
if(jComboBox1.getSelectedIndex()==1)
{
JOptionPane.showMessageDialog(NewJFrame.this, "管理员帐号不提供注册java窗口关闭事件代码!", "", JOptionPane.DEFAULT_OPTION);
}
else
{
reg register=new reg();
register.setTitle("注册");
register.setLocationRelativeTo(this);
register.setVisible(true);
}
}
}
//设置setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);在另一个方法,java窗口关闭事件代码你怎么用到你这个F呢java窗口关闭事件代码?
关于java窗口关闭事件代码和java关闭当前窗口打开新窗口的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读