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

JProgressBar - setValue() fails to throw exception.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.6
    • client-libs



      Name: mf23781 Date: 07/03/98


      *Symptoms:

      If a range is defined for a JProgressBar object with the setMinimum and
      setMaximum methods. When an attempt to use the setValue method to set a
      value outside of the defined range then an IllegalArgumentException should
      be thrown. However this is not the case, the value is accepted with no
      error.
       
      -----------------------------------------------------------------
      import java.awt.*;
      import com.sun.java.swing.*;

      public class JProgressBarTest
      {
      public JProgressBarTest()
      {
      JProgressBar c = new JProgressBar(); //Create JProgressBar object

      c.setMinimum(-5); //Set initial state of ProgressBar
      c.setMaximum(15);
      c.setValue(5);

      try
      {
      c.setValue(-10);
      System.out.println("IllegalArgumentException was not thrown");
      }
      catch(IllegalArgumentException e)
      {
      System.out.println("Exception "+e);
      }
      }

      public static void main(String argv[])
      {
      JProgressBarTest p = new JProgressBarTest();
      }
      }

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

            sswingtrsunw Swingtraq Swingtraq (Inactive)
            miflemi Mick Fleming
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: