Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6725409

Unable to localize JInternalFrame system menu during run-time

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b38
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Not verified

      Backports

        Description

        FULL PRODUCT VERSION :
        Java 6u10

        ADDITIONAL OS VERSION INFORMATION :
        Windows XP 5.1.2600

        A DESCRIPTION OF THE PROBLEM :
        Ok, the problem that I have is this: I can localize the tooltips for the close, maximize, minimize, and restore buttons that can be displayed in the upper left hand corner of the JInternalFrame in real-time, however the items that I cannot get localized all of the time (more on that below) are the items that are located in the JInternalFrames system menu (which is displayed by clicking the upper left hand corner of the JInternalFrame, the text that shows up by default is:

        Restore
        Move
        Size
        Minimize
        Maximize
        Close

        Now here is the kicker, the following code DOES work to localize the above text if this code runs BEFORE the application is instantiated:

        UIManager.put("InternalFrameTitlePane.closeButtonText", bundle.getString("frameTitlePane.closeButtonText"));
        UIManager.put("InternalFrameTitlePane.minimizeButtonText", bundle.getString("frameTitlePane.minimizeButtonText"));
        UIManager.put("InternalFrameTitlePane.restoreButtonText", bundle.getString("frameTitlePane.restoreButtonText"));
        UIManager.put("InternalFrameTitlePane.maximizeButtonText", bundle.getString("frameTitlePane.maximizeButtonText"));
        UIManager.put("InternalFrameTitlePane.moveButtonText", bundle.getString("frameTitlePane.moveButtonText"));
        UIManager.put("InternalFrameTitlePane.sizeButtonText", bundle.getString("frameTitlePane.sizeButtonText"));

        HOWEVER if I include this code inside of my application and run it by, for example, selecting a language from a JComboBox it does NOT update.

        Now, I've looked at the code and the reason this happens is because the above properties are used to create static final variables. This makes it impossible to fully localize an application such that the language can be changed on-the-fly.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Create a new swing application and setup a JDesktopPane w/ some JInternalFrames and try the code setup in the description (using other strings than those being pulled from the ResourceBundle obviously), then check the system menu on the JInternalFrames, they'll still be the default values. If you then take the above code and move it outside of the Swing application, such that it runs before the Swing app is instantiated you'll get the custom text.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The values that are set using the UIManager.put() method should be reflected in the System Menu for the JInternalFrames
        ACTUAL -
        Default values were displayed instead of the localized text.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        UIManager.put("InternalFrameTitlePane.closeButtonText", bundle.getString("frameTitlePane.closeButtonText"));
        UIManager.put("InternalFrameTitlePane.minimizeButtonText", bundle.getString("frameTitlePane.minimizeButtonText"));
        UIManager.put("InternalFrameTitlePane.restoreButtonText", bundle.getString("frameTitlePane.restoreButtonText"));
        UIManager.put("InternalFrameTitlePane.maximizeButtonText", bundle.getString("frameTitlePane.maximizeButtonText"));
        UIManager.put("InternalFrameTitlePane.moveButtonText", bundle.getString("frameTitlePane.moveButtonText"));
        UIManager.put("InternalFrameTitlePane.sizeButtonText", bundle.getString("frameTitlePane.sizeButtonText"));
        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                mlapshin Mikhail Lapshin (Inactive)
                Reporter:
                ndcosta Nelson Dcosta (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: