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

Arabic in JMenu

    XMLWordPrintable

    Details

      Description

      FULL PRODUCT VERSION :
      java 1.4.2_10
      java 1.5.0_06
      6.0 Build 65

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP SP2

      A DESCRIPTION OF THE PROBLEM :
      When using JMenuBar and JMenu with ComponentOrientation (ComponentOrientation.RIGHT_TO_LEFT) the arrow keys are swapped
      it means that i must click left inorder to go right and click right in order to go left , in avery annoying manner to the user

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1- create a JMenuBar and set the ComponentOrientation
      menuBar. setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT)
      2- create a JMenu and set the ComponentOrientation
      menu. setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT)
      3- add JMenuItem to the menu and try to use the arrow keys to navigate in the menu

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      click the left key to move left and the right key to move right
      ACTUAL -
      click the left key to move right and the right key to move left

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.util.*;
      import java.awt.event.*;
      import javax.swing.*;

      class test
      {
          public static void main(String[] ignore) {
          JFrame frame = new JFrame("MenuBarLogo");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

          frame.getContentPane().add(makePane());

          frame.setSize(300,80);
          frame.show();
        }
        static JComponent makePane() {

          JMenuBar menuBar = new JMenuBar(); {
      // menuBar.setComponentOrientation(ComponentOrientation.getOrientation(new Locale("ar")));
      menuBar.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

      JMenu j1 = new JMenu("File");
      JMenu j2 = new JMenu("Edit");
      JMenu j3 = new JMenu("OPen");
      JMenu j4 = new JMenu("Save");
      JMenu j5 = new JMenu("New");
      j1.setComponentOrientation(ComponentOrientation.getOrientation(new Locale("ar")));
      j2.setComponentOrientation(ComponentOrientation.getOrientation(new Locale("ar")));
      j3.setComponentOrientation(ComponentOrientation.getOrientation(new Locale("ar")));
      j4.setComponentOrientation(ComponentOrientation.getOrientation(new Locale("ar")));
      j5.setComponentOrientation(ComponentOrientation.getOrientation(new Locale("ar")));
            menuBar.add(j1);
            menuBar.add(j2);
            menuBar.add(j3);
            menuBar.add(j4);
            menuBar.add(j5);
          }
          return menuBar;
        }
      }
      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: