XAWT: Scrollbar can't be controlled by keyboard

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 5.0
    • Affects Version/s: 5.0
    • Component/s: client-libs
    • b30
    • x86
    • linux



      Name: dmR10075 Date: 10/24/2003



      Run the following test case with XAWT. Click on scrollbar to give it
      focus. Press Up, Down, PgUp etc - they don't scroll the scrollbar. Run
      the test with Motif or on Windows - scrollbar responds to the key events
      by scrolling.

      import java.awt.*;
      import java.awt.event.*;

      public class ScrollBarTest1 extends Frame implements AdjustmentListener
      ,KeyListener {

          public ScrollBarTest1() {
              Scrollbar scrollbar = new Scrollbar(Scrollbar.VERTICAL,0, 1, 0,
      255);
              add("East", scrollbar);
              scrollbar.addAdjustmentListener(this);
              scrollbar.addKeyListener(this);
          }

          public void adjustmentValueChanged(AdjustmentEvent e) {
              System.out.println("Adjustment Event called ");
          }

          public void keyPressed(KeyEvent e) {
            System.out.println("KeyPressed called");
          }

          public void keyReleased(KeyEvent e ){
             System.out.println("in keyReleased");
          }

          public void keyTyped(KeyEvent e ){
             System.out.println("in keyTyped");
          }

           public static void main(String argv[]) {
              ScrollBarTest1 scrollBarTest = new ScrollBarTest1();
              scrollBarTest.setBackground(Color.red);
              scrollBarTest.setSize(500,200);
              scrollBarTest.setVisible(true);
              scrollBarTest.toFront();
          }

      }

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

            Assignee:
            Andrei Dmitriev (Inactive)
            Reporter:
            Dom Dom (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: