Package java.awt

Examples of java.awt.Scrollbar


 
  public void test2(TestHarness harness)
  {
    // This test ensures that if visibleAmount < 0, then
    // it is set to 1.
    Scrollbar bar = new Scrollbar();
    bar.setValues(4, -5, 4, 8);
    harness.check(bar.getValue(), 4);
    harness.check(bar.getVisibleAmount(), 1);
    harness.check(bar.getMinimum(), 4);
    harness.check(bar.getMaximum(), 8);
  }
View Full Code Here


 
  public void test3(TestHarness harness)
  {
    // This test ensures that if visibleAmount = 0, then
    // it is set to 1.
    Scrollbar bar = new Scrollbar();
    bar.setValues(0, 0, 5, 10);
    harness.check(bar.getValue(), 5);
    harness.check(bar.getVisibleAmount(), 1);
    harness.check(bar.getMinimum(), 5);
    harness.check(bar.getMaximum(), 10);
  }
View Full Code Here

  }
  public void test4(TestHarness harness)
  {
    // This test ensures that if maximum < minimum, then
    // maximum is set to minimum + 1.
    Scrollbar bar = new Scrollbar();
    bar.setValues(10, 1, 10, 5);
    harness.check(bar.getValue(), 10);
    harness.check(bar.getVisibleAmount(), 1);
    harness.check(bar.getMinimum(), 10);
    harness.check(bar.getMaximum(), 11);
  }
View Full Code Here

 
  public void test5(TestHarness harness)
  {
    // This test ensures that if value > maximum - visibleAmount,
    // then value is set to maximum - visibleAmount.
    Scrollbar bar = new Scrollbar();
    bar.setValues(10, 1, 5, 10);
    harness.check(bar.getValue(), 9);
    harness.check(bar.getVisibleAmount(), 1);
    harness.check(bar.getMinimum(), 5);
    harness.check(bar.getMaximum(), 10);
  }
View Full Code Here

 
  public void test6(TestHarness harness)
  {
    // This test ensures that if visibleAmount > maximum - minimum,
    // then visibleAmount is set to maximum - minimum.
    Scrollbar bar = new Scrollbar();
    bar.setValues(5, 30, 5, 20);
    harness.check(bar.getValue(), 5);
    harness.check(bar.getVisibleAmount(), 15);
    harness.check(bar.getMinimum(), 5);
    harness.check(bar.getMaximum(), 20);
  }
View Full Code Here

 
  public void test7(TestHarness harness)
  {
    // This test ensures that if maximum = minimum,
    // then maximum is set to maximum + 1.
    Scrollbar bar = new Scrollbar();
    bar.setValues(5, 10, 20, 20);
    harness.check(bar.getValue(), 20);
    harness.check(bar.getVisibleAmount(), 1);
    harness.check(bar.getMinimum(), 20);
    harness.check(bar.getMaximum(), 21);
  }
View Full Code Here

  {
    // This test ensures that if negative values are passed
    // as the value, minimum and maximum values, then
    // there is no effect.  That is, they are not rejected or
    // made positive. 
    Scrollbar bar = new Scrollbar();
    bar.setValues(-3, -2, -4, -8);
    harness.check(bar.getValue(), -4);
    harness.check(bar.getVisibleAmount(), 1);
    harness.check(bar.getMinimum(), -4);
    harness.check(bar.getMaximum(), -3);
  }
View Full Code Here

  public void test9(TestHarness harness)
  {
    // This test is taken from Intel's test suite
    // (test.java.awt.ScrollbarTest).  It passes on Sun
    // but fails on Classpath.
    Scrollbar bar = new Scrollbar();
    bar.setValues(0, 10, -100, 100);
    harness.check(bar.getValue(), 0);
    harness.check(bar.getVisibleAmount(), 10);
    harness.check(bar.getMinimum(), -100);
    harness.check(bar.getMaximum(), 100);
    bar.setMinimum(Integer.MIN_VALUE);
    harness.check(bar.getValue(), -11);
    harness.check(bar.getVisibleAmount(), 10);
    harness.check(bar.getMinimum(), Integer.MIN_VALUE);
    harness.check(bar.getMaximum(), -1);
  }
View Full Code Here

  public void test10(TestHarness harness)
  {
    // This test ensures that lineIncrement is not effected
    // if it is greater than the range.
    Scrollbar bar = new Scrollbar();
    bar.setValues(1, 1, 1, 2);
    harness.check(bar.getValue(), 1);
    harness.check(bar.getVisibleAmount(), 1);
    harness.check(bar.getMinimum(), 1);
    harness.check(bar.getMaximum(), 2);
    bar.setUnitIncrement(4);
    harness.check(bar.getUnitIncrement() >
                    (bar.getMaximum() - bar.getMinimum()));
    harness.check(bar.getUnitIncrement() == 4);
    harness.check(bar.getUnitIncrement() !=
                    (bar.getMaximum() - bar.getMinimum()));
  }
View Full Code Here

 
  public void test11(TestHarness harness)
  {
    // This test ensures that pageIncrement is not effected
    // if it is greater than the range.
    Scrollbar bar = new Scrollbar();
    bar.setValues(1,1,1,2);
    harness.check(bar.getValue(), 1);
    harness.check(bar.getVisibleAmount(), 1);
    harness.check(bar.getMinimum(), 1);
    harness.check(bar.getMaximum(), 2);
    bar.setBlockIncrement(4);
    harness.check(bar.getBlockIncrement() >
                    (bar.getMaximum() - bar.getMinimum()));
    harness.check(bar.getBlockIncrement() == 4);
    harness.check(bar.getBlockIncrement() !=
                    (bar.getMaximum() - bar.getMinimum()));
  }
View Full Code Here

TOP

Related Classes of java.awt.Scrollbar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.