swingx
  1. swingx
  2. SWINGX-1432

JXFindBar and JXSearchPanel don't properly update labels to English when created on Spanish locale

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6.2
    • Fix Version/s: 1.6.3
    • Component/s: Search
    • Labels:
      None
    • Environment:

      Java SE 6u23

      Description

      JXFindBar and JXSearchPanel, both extending AbstractPatternPanel, fail to update their labels and other texts when changing locale to English if the locale they were created with was Spanish, but it doesn't fail if it was French or English.

      Notice that Spanish is not on the Locale standard definitions (Locale.XXXX) and has to be instanced as new Locale("es"), or "es_ES" for Spanish from Spain.

      Additionally the combo in JXSearchPanel is never localized.

      Example code:

      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.util.Locale;
      import java.util.Vector;
      import javax.swing.JComboBox;
      import javax.swing.JFrame;
      import javax.swing.SwingUtilities;
      import org.jdesktop.swingx.JXFindBar;
      import org.jdesktop.swingx.JXFrame;
      import org.jdesktop.swingx.JXFrame.StartPosition;
      import org.jdesktop.swingx.JXPanel;
      import org.jdesktop.swingx.JXSearchPanel;
      import org.jdesktop.swingx.VerticalLayout;

      public class JXFindBarLocaleTest {

      public static final Locale EN_LOCALE = Locale.ENGLISH;
      public static final Locale ES_LOCALE = new Locale("es");
      public static final Locale FR_LOCALE = Locale.FRENCH;

      public static void main(String... args) {
      /* Uncomment one to choose */
      // Locale.setDefault(EN_LOCALE);
      Locale.setDefault(ES_LOCALE);
      // Locale.setDefault(FR_LOCALE);

      SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
      JFrame.setDefaultLookAndFeelDecorated(true);

      JXFrame frame = new JXFrame();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setStartPosition(StartPosition.CenterInScreen);

      final JXFindBar findBar = new JXFindBar();
      final JXSearchPanel searchPanel = new JXSearchPanel();

      Vector<Locale> locales = new Vector<Locale>();
      locales.add(EN_LOCALE);
      locales.add(ES_LOCALE);
      locales.add(FR_LOCALE);
      final JComboBox localeCombo = new JComboBox(locales);
      localeCombo.setSelectedItem(Locale.getDefault());
      localeCombo.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
      Locale locale = (Locale) localeCombo.getSelectedItem();
      findBar.setLocale(locale);
      searchPanel.setLocale(locale);
      }});

      JXPanel contentPane = new JXPanel(new VerticalLayout());
      contentPane.add(findBar);
      contentPane.add(searchPanel);
      contentPane.add(localeCombo);
      frame.setContentPane(contentPane);

      frame.pack();
      frame.setVisible(true);
      }});
      }

      }

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            kleopatra
            Reporter:
            dsmania
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: