58,452
社区成员




public class mainframe extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
mainframe frame = new mainframe();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public mainframe() {
JButton button = new JButton("\u8FD4\u56DE\u767B\u5F55");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Login newform=new Login();
newform.setVisible(true);
//我想在此处添加dispose方法
}
});
button.setToolTipText("");
button.setFont(new Font("微软雅黑", Font.PLAIN, 17));
button.setBounds(40, 341, 113, 27);
contentPane.add(button);
}
}
public void actionPerformed(ActionEvent e) {
Login newform=new Login();
newform.setVisible(true);
//我想在此处添加dispose方法
dispose();
}
这样就可以