0
我試圖讓點擊'右鍵'點擊貝寶徽標出現。不幸的是,所有顯示的是咖啡和一支筆的默認Java標誌。ImageIcon +關閉點擊一個JOptionPane
另外,如何讓它一旦你點擊「確定」或「取消」它關閉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);
謝謝!