我有这个 gui,提示用户在个人或公司之间进行选择,但我希望取消按钮返回程序的开头或主框架。
int chooseVehicleType = JOptionPane.showOptionDialog(this,
"What kind of vehicle is it?", "Choose and option",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
vehicle, "");
if (chooseVehicleType == 1) {
int result2 = JOptionPane.showConfirmDialog(null, truck,
"Enter the truck details", JOptionPane.OK_CANCEL_OPTION);
// Printing out the input of the user in the center panel
if (result2 == JOptionPane.OK_OPTION) {
//Do stuff here, proceed to he next prompt window
}
if (result2 == JOptionPane.CANCEL_OPTION) {
updateCenterPanel("Operation cancelled!");
/* Updating the center panel,
* but also close the operation
* and go back to the main screen
*/
}
所以,我走到了这一步。但是现在用户被提示到下一个选择屏幕,而不是回到主框架。
有任何想法吗?我已经用完了它们...在此先感谢!