Search code examples
javaswinglayoutjoptionpane

how to represent a vertical showOptionDialog button


I would like to represent my buttons in a vertical way and here is my code:

these are my buttons' labels code:

String[] choices = {"31", "63", "127", "255", "511", "1023", "2047", " ... or Quit"};

and here is the dialog box options :

while (true) {
        int response = JOptionPane.showOptionDialog(
                           null                      
                         , "Please select the sequence-length you want ...\n"   
                         , "Gold Code generator"      
                         , JOptionPane.YES_NO_OPTION  
                         , JOptionPane.PLAIN_MESSAGE  
                         , null                      
                         , choices                  
                         , "None of your business"    
                       );

so ... can it be represented in a vertical way instead of the common horizontal way?


Solution

  • JOptionPane does not have a vertical button orientation option; you would have to create your own dialog by subclassing JDialog to do this.