ユーザーが右上の X をクリックしても、何も起こらないようにしたいです。これを実現するコード行は何ですか?
Object [] options1 = {"Go Back", "Accept"};
int a3 =JOptionPane.showOptionDialog(null,"Mean arterial pressure restored.\nReassess all vitals STAT.", "Title", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options1, options1[0]);
if(a3 == JOptionPane.CLOSED_OPTION)
{
//what should i put here? if user X out, I want no response (DO_NOTHING_ON_CLOSE)
}
if(a3 == JOptionPane.YES_OPTION)
{
// doing something else
}
if (a3 == JOptionPane.NO_OPTION)
{
//doing something else
}
a3.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); のようなものを試しました。しかし、エラー int cannot be dereferenced が表示されます