我有一個在關閉我的應用程序時顯示的選項窗格(windowClosing()
)。 我有退出,最小化或取消的選項。取消選項窗格
如何在不關閉整個應用程序的情況下關閉選擇「取消」的選項窗格?
Object[]options = {"Minimize", "Exit","Cancel"};
int selection = JOptionPane.showOptionDialog(
null, "Please select option", "Options", 0,
JOptionPane.INFORMATION_MESSAGE, null, options, options[1]);
System.out.println(selection);
switch(selection)
{
case 2:
{
// do something
}
}
請發佈你正在做的事情的全部代碼,當調用JOptionPane時,等等。 – Marcelo 2012-03-23 11:42:52