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

Jslider - mouse click ont the left side of the knob is ignored.

XMLWordPrintable

    • b10
    • x86
    • windows_xp
    • Verified

      FULL PRODUCT VERSION :
      1.4.2_10

      ADDITIONAL OS VERSION INFORMATION :
      WindowsXP SP2

      A DESCRIPTION OF THE PROBLEM :
      When I click a JSlider on the left side of the knob,
      it doesn't move and the value is not changed.

      When I click it on the right side of the knob,
      it moves correctly.

      This problem occurs with the follwing parameters.
      - Maximum: 50
      - Minimum: 0
      - Snap To Ticks: true
      - Minor tick spacing: 10

      According to BasicSliderUI.java:397,
      You use Math.round() to compute a snaped value.

      But in this case default moving unit is 5 ( (max - min) / 10 ).
      So the value is always rounded to upper value.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. create a JSlider on any form.
      2. set follwing parameters to the JSlider
         - max: 50
         - min: 0
         - setSnapToTicks() : true
         - minor tick spacing: 10
      3. run the program
      4. click on the left side of the knob.
      5. nothing happens(THIS iS THE PROBLEM!)


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When I click on the left side of the knob,
      the knob (and actual value) should be changed.

      ACTUAL -
      The knob (and actual value) does not changed.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /*
       * NewJFrame.java
       *
       * Created on 2006/03/09, 12:57
       */

      package javaapplication1;

      import javax.swing.*;

      /**
       *
       * @author konparu
       */
      public class NewJFrame extends javax.swing.JFrame {
          
          /** Creates new form NewJFrame */
          public NewJFrame() {
              initComponents();
          }
          
          /** This method is called from within the constructor to
           * initialize the form.
           * WARNING: Do NOT modify this code. The content of this method is
           * always regenerated by the Form Editor.
           */
          private void initComponents() {
              jSlider1 = new javax.swing.JSlider();

              setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
              jSlider1.setMajorTickSpacing(0);
              jSlider1.setMaximum(50);
              jSlider1.setMinorTickSpacing(10);
              jSlider1.setPaintLabels(true);
              jSlider1.setPaintTicks(true);
              jSlider1.setSnapToTicks(true);
              getContentPane().add(jSlider1, java.awt.BorderLayout.CENTER);

              pack();
          }
          
          /**
           * @param args the command line arguments
           */
          public static void main(String args[]) {
              java.awt.EventQueue.invokeLater(new Runnable() {
                  public void run() {
                      try{
                          javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
                          new NewJFrame().setVisible(true);
                      }catch(Exception e){
                          
                      }
                  }
              });
          }
          

          private javax.swing.JSlider jSlider1;
          
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      none so far

            alexp Alexander Potochkin (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: