public void jMenuItemNewGameActionPerformed(java.awt.event.ActionEvent evt) { // Custom button text Object[] optionPane = {"Load Board from File", "Random Board"}; int selection = JOptionPane.showOptionDialog( frame, "Please select an option: ", "New Board", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, optionPane, optionPane[1]); if (selection == 0) { this.jFrameFileChooser.pack(); this.jFrameFileChooser.setVisible(true); jFileChooser.enable(); jFileChooser.setVisible(true); } else { // random board } }