Package java.awt

Examples of java.awt.Scrollbar$State


  }
  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

        }

        // Place the board viewer in a set of scrollbars.
        scroller = new Panel();
        scroller.setLayout(new BorderLayout());
        vScrollbar = new Scrollbar(Scrollbar.VERTICAL);
        hScrollbar = new Scrollbar(Scrollbar.HORIZONTAL);
        scroller.add(this, BorderLayout.CENTER);

        // Assign the scrollbars to the board viewer.
        scroller.add(vScrollbar, BorderLayout.EAST);
        scroller.add(hScrollbar, BorderLayout.SOUTH);
View Full Code Here

    public Slider(Frame parent, String title, String question,
            int defaultValue, int min, int max) {
        super(parent, title, true);
        super.setResizable(false);

        value = new Scrollbar(Scrollbar.HORIZONTAL, defaultValue, 1, min,
                max + 1);
        value.addAdjustmentListener(this);

        setLayout(new BorderLayout());
        Panel qp = new Panel();
View Full Code Here

TOP

Related Classes of java.awt.Scrollbar$State

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.