0

I'm trying to get the PayPal logo come up when you click the 'rightbutton' is clicked. Unfortunately, all that shows is the default Java logo with the cup of coffee and a pen.

Also, how can I make it so once you click "OK" or "Cancel" it closes the JOptionPane, currently, when you click "OK" nothing happens, it keeps giving you the "OK" / "Cancel" option.

    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);

thanks!

Barett
  • 5,826
  • 6
  • 51
  • 55
user3377462
  • 13
  • 1
  • 4

1 Answers1

0

I see you trying to use a JOptionPane where a JFrame will be more useful.

A JOptionPane is simply used as an information or error message where as a JFrame is for everything else.

Solution:

Make a JFrame, add a JLabel to it and set it as an image with JLabel.setImage("Directory");

and then add two buttons, Ok and Cancel.

I would Suggest netbeans JFrame form editor.

And if you are still new to java try downloading some examples and working from them and also try getting a book on java programming.

Good luck.

Luke Melaia
  • 1,470
  • 14
  • 22