Examples of ScrollBar


Examples of java.awt.Scrollbar

        fFont = new Font("Dialog", Font.PLAIN, 12);

        setLayout(null);

        sbHoriz = new Scrollbar(Scrollbar.HORIZONTAL);

        add(sbHoriz);

        sbVert = new Scrollbar(Scrollbar.VERTICAL);

        add(sbVert);
    }
View Full Code Here

Examples of java.awt.Scrollbar

        });
        add(b, BorderLayout.CENTER);
        b.setBackground(Color.YELLOW);

        final Button b2 = new Button("Left");
        final Scrollbar sb = new Scrollbar(Scrollbar.HORIZONTAL);
        final Checkbox cb1 = new Checkbox("Right");

        add(b2, BorderLayout.WEST);
        b2.setBackground(Color.RED);
        b2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("Action on b2");
                if (sb.getValue() + sb.getBlockIncrement() <= sb.getMaximum()) {
                    sb.setValue(sb.getValue() + sb.getBlockIncrement());
                } else {
                    Frame f2 = new Frame("New frame");
                    f2.setSize(200, 100);
                    f2.setVisible(true);
                }
View Full Code Here

Examples of java.awt.Scrollbar

   */
  public void test(TestHarness harness)
  {
    setBackground(Color.red);
    Frame f = new Frame();
    Scrollbar c = new Scrollbar();
    add(c);
    f.add(this);
    f.pack();
    f.show();
    Rectangle bounds = c.getBounds();
    Insets i = f.getInsets();
    Point loc = f.getLocationOnScreen();
    loc.x += i.left + bounds.x;
    loc.y += i.top + bounds.y;
    bounds.x += i.left;
View Full Code Here

Examples of java.awt.Scrollbar

public class testSetBlockIncrement implements Testlet
{

  public void test(TestHarness harness)
  {
    Scrollbar bar = new Scrollbar();
   
    // This check shows that the default value of pageIncrement is 10.
    harness.check(bar.getBlockIncrement(), 10);
   
    // These checks show that it is not possible to set pageIncrement
    // to 0.  Instead, it is set to 1.
    bar.setBlockIncrement(0);
    harness.check(bar.getBlockIncrement(), 1);
    bar.setBlockIncrement(5);
    harness.check(bar.getBlockIncrement(), 5);
    bar.setBlockIncrement(0);
    harness.check(bar.getBlockIncrement(), 1);
   
    // These checks show that there was unnecessary code in the method.
    // The unnecessary code would produce a value of 9 as the pageIncrement,
    // when in fact it should be set to 30.
    // NOTE: It is no longer necessary to check if
    // (maximum - minimum) == 0 because maximum will never equal minimum.
    bar.setMaximum(10);
    bar.setMinimum(1);
    harness.check(bar.getMaximum(), 10);
    harness.check(bar.getMinimum(), 1);
    harness.check(bar.getBlockIncrement(), 1);
    bar.setBlockIncrement(30);
    harness.check(bar.getBlockIncrement(), 30);
    harness.check(bar.getBlockIncrement() != 9);
   
    // This test ensures that pageIncrement is not effected
    // if it is greater than the range.
    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

Examples of java.awt.Scrollbar

public class testSetUnitIncrement implements Testlet
{

  public void test(TestHarness harness)
  {
    Scrollbar bar = new Scrollbar();
   
    // This check shows that the default value of lineIncrement is 1.
    harness.check(bar.getUnitIncrement(), 1);
   
    // These checks show that it is not possible to set lineIncrement
    // to 0.  Instead, it is set to 1.
    bar.setUnitIncrement(0);
    harness.check(bar.getUnitIncrement(), 1);
    bar.setUnitIncrement(5);
    harness.check(bar.getUnitIncrement(), 5);
    bar.setUnitIncrement(0);
    harness.check(bar.getUnitIncrement(), 1);
   
    // These checks show that there was unnecessary code in the method.
    // The unnecessary code would produce a value of 9 as the lineIncrement,
    // when in fact it should be set to 30.
    // NOTE: It is no longer necessary to check if
    // (maximum - minimum) == 0 because maximum will never equal minimum.
    bar.setMaximum(10);
    bar.setMinimum(1);
    harness.check(bar.getMaximum(), 10);
    harness.check(bar.getMinimum(), 1);
    harness.check(bar.getUnitIncrement(), 1);
    bar.setUnitIncrement(30);
    harness.check(bar.getUnitIncrement(), 30);
    harness.check(bar.getUnitIncrement() != 9);   
   
    // This test ensures that pageIncrement is not effected
    // if it is greater than the range.
    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

Examples of java.awt.Scrollbar

  public void test1(TestHarness harness)
  {
    // This test ensures that if value < minimum, then
    // value is set to minimum.
    Scrollbar bar = new Scrollbar();
    bar.setValues(0, 1, 1, 2);
    harness.check(bar.getValue(), 1);
    harness.check(bar.getVisibleAmount(), 1);
    harness.check(bar.getMinimum(), 1);
    harness.check(bar.getMaximum(), 2);
  }
View Full Code Here

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

Examples of javafx.scene.control.ScrollBar

   *
   */
  private void calculateSizes()
  {
    // generic
    double lScrollbarSize = new ScrollBar().getWidth();
    textHeightProperty.set( new Text("X").getBoundsInParent().getHeight() );
   
    // header
    highestNumberOfWholedayAppointmentsProperty.set(0);
    for (DayPane lDay : weekPane.dayPanes)
View Full Code Here

Examples of org.apache.pivot.wtk.ScrollBar

    @Override
    public void install(Component component) {
        super.install(component);

        ScrollBar scrollBar = (ScrollBar)component;
        scrollBar.getScrollBarListeners().add(this);
        scrollBar.getScrollBarValueListeners().add(this);

        scrollBar.add(scrollUpButton);
        scrollBar.add(scrollDownButton);
        scrollBar.add(handle);

        TerraTheme theme = (TerraTheme)Theme.getTheme();

        Color backgroundColor = theme.getColor(9);
        Color brightBackgroundColor = TerraTheme.brighten(backgroundColor);

        GradientPaint backgroundPaint;
        if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
            backgroundPaint = new GradientPaint(0, 1, backgroundColor,
                0, DEFAULT_THICKNESS - 2, brightBackgroundColor);
        } else {
            backgroundPaint = new GradientPaint(1, 0, backgroundColor,
                DEFAULT_THICKNESS - 2, 0, brightBackgroundColor);
View Full Code Here

Examples of org.apache.pivot.wtk.ScrollBar

        enabledChanged(scrollBar);
    }

    @Override
    public int getPreferredWidth(int height) {
        ScrollBar scrollBar = (ScrollBar)getComponent();

        int preferredWidth = 0;

        if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
           preferredWidth = DEFAULT_LENGTH;
        } else {
           preferredWidth = DEFAULT_THICKNESS;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.