This week's giveaway is in the Cloud/Virtualization forum. We're giving away four copies of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP and have Lucian Maly on-line! See this thread for details.
The layout of the option pane is controlled internally, and there are no methods to directly control the layout of the buttons.
So, the proper solution is to just create a custom modal JDialog that displays the components based on your requirements.
However, if you really want to use the JOptionPane functionality then you would need to:
1. create the JOptionPane as a Swing component and then change the layout manager of the panel containing the buttons.
2. add the JOptionPane to a JDialog and implement the standard option pane functionality manually.
The first step is demonstrated below:
The above code searches for the buttons that have been added to the option pane and then finds the parent container and changes the layout manager of the container to be a GridLayout. You will also need the SwingUtils class.
To implement the second step you will need to Read the API for the JOptionPane. It contains the code necessary add the code to a JDialog and implement the option pane functionality.
That's a very big dog. I think I want to go home now and hug this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners