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

Merlin, Horizontal JScrollBar does not respect ComponentOrientation

XMLWordPrintable

    • beta2
    • generic
    • generic
    • Verified



      Name: jbT81659 Date: 08/06/2001

      OS: All tested OS's with RTL locale support
      JDK: jdk1.4.0-b74
      TestCase: jScrollBar.java

      Horizontal JScrollBar does not respect RTL Component Orientation; i.e Home, End, PageUp, PageDown,
      Up/Down/Right/Left arrows behavior is LTR.

      To reproduce bug:
      1- Under Linux or Solaris, choose an RTL localized OS
         Under Windows chhose Arabic/Hebrew enabled(localized) OS
      2- compile and run the following code
      3- Verify that application is displayed on screen
      4- Press "TAB" to get to Horizontal JScrolBar knob
      5- Press "Home" button on KeyBoard
      6- Note that "Home" position is on the left end of JScrollBar
      7- Press "End" button on KeyBoard
      8- Note that "End" position is on the right end of JScrollBar
      Repeat steps 5-8 with arrows and other keyboard control buttons

      --------------Code----------------
      /* Copyright (c) Sun Microsystems 1998

      $Header: /home-bazelet/sun/src/javaLab/JDK1.4/standard/jScrollBar.java,v 1.1.1.1 2001/06/19 15:01:31 isam Exp $

      */

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class jScrollBar extends JApplet
      {
        public void init()
        {
          ScrollBarExample sbe = new ScrollBarExample();
          getContentPane().add(sbe);

        }

        public static void main(String[] argv)
        {

          JFrame frame = new JFrame("ABCDEFG");
          frame.setContentPane(new ScrollBarExample());
          frame.setSize(300,300);
          frame.setVisible(true);
              frame.addWindowListener( new WindowAdapter()
              {
                   public void windowClosing( WindowEvent e)
                   {
                       System.exit(0);
                   }
              });

        }

      }

      class ScrollBarExample extends JPanel
      {
         JPanel p;
        JLabel label;
        public ScrollBarExample()
        {
          super(true);
          label=new JLabel();
          label.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
          setLayout(new BorderLayout());
          JScrollBar hbar=new JScrollBar(JScrollBar.HORIZONTAL, 30, 20, 0, 300);
          JScrollBar vbar=new JScrollBar(JScrollBar.VERTICAL, 30, 40, 0, 300);
          hbar.setUnitIncrement(2);
          hbar.setBlockIncrement(1);
          hbar.addAdjustmentListener(new MyAdjustmentListener());
          vbar.addAdjustmentListener(new MyAdjustmentListener());
          setBackground(Color.white);
          add(hbar, BorderLayout.SOUTH);
          add(vbar, BorderLayout.EAST);
          add(label, BorderLayout.CENTER);
        }

        class MyAdjustmentListener implements AdjustmentListener
        {
          public void adjustmentValueChanged(AdjustmentEvent e)
          {
            label.setText("\u0627\u0644\u0642\u064a\u0645\u0629\u0020\u0627\u0644\u062c\u062f\u064a\u062f\u0629 " + e.getValue() + " ");
            repaint();
          }
        }
      }

      ----------------------------------


      ======================================================================

            peytoia Yuka Kamiya (Inactive)
            jbenavrasunw Jonathan Benavraham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: