title: How do I arrange buttons vertically in a JOptionPane?
body: <p>I'm trying to make a text-based adventure game where the top of the screen is a JTextArea inside a JScrollPane that shows what is happening, and the bottom is a JOptionPane where you click on a button to make a choice. By default, the buttons are arranged horizontally. The only problem is that if I have too many buttons, there is no room for new ones and they are pushed off the screen. I need them to be arranged vertically since they are fatter than they are tall. The JOptionPane and the JScrollPane are nested in a gridLayout, which is nested in a JFrame. This is the method I am using to make the frame:</p>
  
  <pre><code>/**
   * Make the frame and everything in it
   */
  private void makeFrame()
  {
      frame = new JFrame("Adventure!");
  
      JPanel contentPane = (JPanel)frame.getContentPane();
      contentPane.setBorder(new EmptyBorder(6, 6, 6, 6));
      contentPane.setLayout(new GridLayout(0, 1));
  
      textArea = new JTextArea(20, 50);       
      textArea.setEditable(false);
      textArea.setLineWrap(true);
      textArea.setFont(new Font("font", Font.BOLD, 15));
      JScrollPane scrollPane = new JScrollPane(textArea);
      contentPane.add(textArea);
  
      optionPane = new JOptionPane("", JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION, null, null);
      contentPane.add(optionPane);
  
      frame.pack();
      // place the frame at the center of the screen and show
      Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
      frame.setLocation(d.width/2 - frame.getWidth()/2, d.height/2 - frame.getHeight()/2);
      frame.setVisible(true);
  }
  </code></pre>