我有一個用戶填寫JFrame的表單,然後將收集的數據寫入不同類中的JTable。使JFrame像對話框一樣工作
我想配置它,當用戶選擇「提交」,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和方法是公共createMark
由於任何人誰答覆,
賈裏德。
*「讓JFrame像對話框一樣行事」*你不能從母豬的耳朵上製作絲質錢包。 **使用'JDialog'!** –