-2
我想要它,所以当你点击“确定”或“取消”它关闭。我应该添加什么代码?JOptionPane不会关闭
rightbutton = new JButton("Right.");
add(rightbutton);
rightbutton.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event){
//what do we want to happen when we
//click the button
final ImageIcon icon = new ImageIcon("C:\\Users\\Scr3am\\Desktop\\paypal.jpg");
JOptionPane.showOptionDialog(null,
"Congratulations, you clicked the button.",
"Congrats", JOptionPane.DEFAULT_OPTION,
JOptionPane.INFORMATION_MESSAGE, null,
new Object[] { panel }, icon);
不是你下的选民,但为了更好的帮助下,可以考虑创建和发布一个[小例子程序(http://stackoverflow.com/help/mcve)。请查看链接了解详情。 –
你还没有按照[你以前的问题]的答案(http://stackoverflow.com/questions/22186026/imageicon-help-close-a-joptionpane)。你的论点仍然是错误的 –
好吧,用@ peeskillet的信息,以及你缺乏回应,现在我*是一个低调选民,我投票结束。 –