我有一个表格供用户填写 JFrame,然后将收集的数据写入不同类的 JTable。
我正在尝试将其配置为当用户选择“提交”时 JFrame 将关闭,但不会关闭程序。我需要什么命令来实现这一点?
提交按钮的代码如下:
JButton bMark = new JButton("Submit");
bMark.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String start = tbStart.getText();
String end = tbEnd.getText();
String[] marking = {start, end, active, body, dysk, trem, brady};
//This is just for me to ensure the collected data is correct
System.out.println(marking[0] + " " +marking[1] + " " +marking[2] + " " +
marking[3] + " " + marking[4] + " " + marking[5] + " " + marking[6]);
//This is is the class the form data is being sent to
markTable.main(marking);
//This is where I would like the close the current window
}
});
bMark.setBounds(308, 191, 86, 23);
类名是createMark,方法是public createMark
感谢任何回复的人,
杰瑞德。