2016-04-25 61 views
0

我想从我的主类调用我的JOptionPane 的方法。 有没有具体的方法来做到这一点?如何添加方法到JOptionPane

Dictionary word1 = new Dictionary(null); 
CardCatalog catalog = new CardCatalog(); 

final ImageIcon welcome = new ImageIcon("welcome.jpg"); 
JOptionPane.showMessageDialog (null,"","WELCOME TO FLASH CARD",JOptionPane.INFORMATION_MESSAGE,welcome); 

回答

0

使用showmessage方法这样

JOptionPane.showMessageDialog(frame, Myclass.dosomethign()); 

但要确保该方法的返回类型为字符串,因为showmessage方法接受一个字符串作为第二个参数