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

The mouse and keyboard act differently on a JSlider when an extent is set.

XMLWordPrintable

    • beta
    • x86
    • windows_95


      With and extent set if you select JSlider knob and use the keyboard (Left, Right, Home, End, PgUp, PgDn keys) to move the knob,
      you can not reach slider's label that corresponds with a value greater then 80, but you can reach further knob positions using the mouse.

      I would expect the slider to act the same, regardless of the input device.

      JCK Test Failure:
      api/javax_swing/interactive/JSliderTests.html#JSlider


      Sample Code:

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

      public class test extends JFrame {
          JSlider aSlider;

          public test() {
              super("JSlider test (Extent=20)");
              aSlider = new JSlider(0);
              aSlider.setMajorTickSpacing(10);
              aSlider.setExtent(20);
              aSlider.setPaintLabels(true);
              aSlider.setPaintTicks(true);
              getContentPane().add(aSlider,BorderLayout.CENTER);
              aSlider.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    setTitle("Extent="+aSlider.getExtent()+", Value="+aSlider.getValue()); }
               });
          }

          public static void main(String[] args) {
              JFrame frame = new test();
              frame.setSize(new Dimension(300,100));
              frame.setVisible(true);
          }
      }

            svioletsunw Scott Violet (Inactive)
            jdixonsunw John Dixon (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: