Package java.awt

Examples of java.awt.Scrollbar


    selectionForeground = Color.white;
    setBackground(SystemColor.text);
    setForeground(SystemColor.textText);
    cellRenderer = new DefaultTableCellRenderer();
    setLayout(null);
    sbHoriz = new Scrollbar(Scrollbar.HORIZONTAL);
    sbHoriz.addAdjustmentListener(this);
    add(sbHoriz);
    sbVert = new Scrollbar(Scrollbar.VERTICAL);
    sbVert.addAdjustmentListener(this);
    dPreferred = new Dimension(480,320);
    add(sbVert);
    addMouseListener(new MouseAdapter() {
      public void mouseClicked(MouseEvent e) {
View Full Code Here


        vData = new Vector();

        setLayout(null);

        sbHoriz = new Scrollbar(Scrollbar.HORIZONTAL);

        add(sbHoriz);

        sbVert = new Scrollbar(Scrollbar.VERTICAL);

        add(sbVert);
    }
View Full Code Here

        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

        ((Scrollbar)com).addAdjustmentListener(this);
    }

    public Object createComponentInstance(Object parent, DomNode element)
    {
        Scrollbar bar = new Scrollbar();
        return bar;
    }
View Full Code Here

        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

        });
        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

   */
  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

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

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

  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

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.