我有这个主要的 JFrame(称之为 DrinkChooser),它显示了另一个复杂的确认 JFrame(称之为 ConfirmWin)。
ConfirmWin 只有两个 JButton,确认和取消。
我想做这个:
(在 DrinkChooser 中,假设 DrinksChoosen 是一个 Drink[])
public void handleAction(){
int choice = ConfirmWin.showDrinkConfirmation(drinksChoosen);
if(choice == ConfirmWin.CONFIRM)
//Handle confirmation.
else
//handle cancel, do nothing.
}
我想实现一个尽可能接近“JOptionPane 效果”的效果,即原来的 DrinkChooser 被挂起,ConfirmWin 返回用户的选择。
谢谢。