Saturday, October 1, 2011

Changing Buttons alignment in JOptionPane

Ever wondered how to change the alignment of options in Swing JOptionPage dialog?

It's just one line of code:
UIManager.getDefaults().put("OptionPane.buttonOrientation", SwingConstants.RIGHT);

The list of all component properties is available here:
http://download.oracle.com/javase/1.5.0/docs/api/javax/swing/plaf/synth/doc-files/componentProperties.html

0 comments: