How do I change the ComponentOrientation of JOptionPane dialogs created via the static<xxx>Dialog or showInternal<xxx>Dialog methods?

Sandip Chitale can't. That is because the methods are static and therefore you cannot override them. Secondly the class used for JOptionPane is not parametrized. It is hardcoded as JOptionPane. May be, they should have allowed parameterizing the class and used reflection to create objects.

NOTE: JOptionPane is not a subclass of JDialog. It uses a createDialog(...) factory method to create the Dialog which is shown. Therefore if you use the constructors instead of static showXXXDialog(...) methods to create and show the JOptionPanes, you could override the createDialog(...) method and apply ComponentOrientation to those. Starting JDK1.2 there is a convinience method

public void applyResourceBundle(ResourceBundle rb)
    Apply the settings in the given
    ResourceBundle to this Window. Currently,
    this applies the ResourceBundle's
    ComponentOrientation to this Window and all
    components contained within it.

in java.awt.Window (of which JDialog is a subclass) for applying the ComponentOrientation resourceBundle.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact