title: JOptionPane Array Elements
body: <p>I have been trying to work this out for the passed couple of days while trying to learn java. I have been teaching myself how to use option panes to display messages and I have recently tried to make use of the buttons but I am having no luck getting further in the code when I try and pass through the array Elements. Here is my code so far; I have managed to create the <code>JOptionPane</code> and I have told it what to do when a button has been pressed but as I run the code, it does nothing. Can anyone help me?</p>
  
  <pre><code>import javax.swing.JFrame;
  import javax.swing.JOptionPane;
  
  public class Tinker01
  {
  
      public static void main(String[] args)
      {
          AdultTicket adultTicket = new AdultTicket();
          ChildTicket childTicket = new ChildTicket();
          OverFiftyTicket overFiftyTicket = new OverFiftyTicket();
          JFrame frame = new JFrame();
  
          String[] options =
              {"Adult Ticket" , "Childs Ticket" , "Over Fifty Ticket" };
          JOptionPane.showOptionDialog(frame, "What ticket would you like to buy? " + " ", " ",
              JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[2]);
  
          if (options.equals(options[0]))
          {
              JOptionPane.showMessageDialog(frame, "Your ticket price is £" + adultTicket.getAdultTicket());
          }
          else if (options.equals(options[1]))
          {
              JOptionPane.showMessageDialog(frame, "Your ticket price is £" + childTicket.getChildTicket());
          }
          else if (options.equals(options[2]))
          {
              JOptionPane.showMessageDialog(frame, "Your ticket price is £" + overFiftyTicket.getOverFiftyTicket());
          }
        }
  }
  </code></pre>