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

Wrong sash movement in Horizontal JScrollBar under GTK LAF

    Details

    • Subcomponent:
    • Resolved In Build:
      tiger
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description



      Name: jbT81659 Date: 01/15/2003

      Locale: Solaris, Linux and windows
      Regression: NO
      Build: b12

      Under Metal, Motif and Windows LookAndFeel's, pressing the right arrow
      key on the keyboard moves the horizontal JScrollBar sash toward the right end
      of the JScrollBar i.e to the "End " position, while pressing the left arrow
      moves the sash in steps toward the begining of the JScrollBar i.e the "Home"
      position.

      Under GTK LAF the sash movement using the keyboard arrow keys is opposite to
      the expected behavior. Pressing the right arrow key on the keyboard causes the sash
      to move toward the "Home" position instead of the "End" position, while
      pressing the
      left arrow causes the sash to move toward the "End" position instead of "Home"
      position.


      To reproduce bug:

      1. Under Linux or Solaris OS compile the following code (jScrollBar.java)
      2. Execute the test case with folowing command
      "java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel jSCrollBar"
      3. Press Tab to move focus to the Horizontal ScrollBar
      4. Press the "Home" key
      5. Verify that the sash moves to the "Home" position of the ScrollBar as
      expected
      6. Press the "End" key
      7. Verify that the sash moves to the "End" position of the ScrollBar as
      expected
      8. Use the mouse to position the sash in the middle of the horizontal ScrollBar
      9. Press the Right arrow key on the keyboard
      10. Verify that the sash moves in the wrong direction i.e toward the "Home"
      position
      11. Press the Left arrow key on the keyboard
      10. Verify that the sash moves in the wrong direction i.e toward the "End"
      position

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

      $Header: /home-bazelet/sun/src/javaLab/JDK1.4/standard/jScrollBar.java,v 1.2 2001/08/20 11:19:43 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();
           }
         }
      }

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

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

        Attachments

          Activity

            People

            • Assignee:
              joutwatesunw Joshua Outwater (Inactive)
              Reporter:
              jbenavrasunw Jonathan Benavraham (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: