Package java.awt

Examples of java.awt.Button$State


            public void actionPerformed(ActionEvent event) {
                System.exit(0);
            }
        };

        Button show = new Button("show");
        show.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                f2.setVisible(true);
            }
        });
        //f.add(show);
        Button hide = new Button("hide");
        hide.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                f2.setVisible(false);
            }
        });
        //f.add(hide);
        Button back = new Button("back");
        back.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                f2.toBack();
            }
        });
        //f.add(back);
        Button front = new Button("front");
        front.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                f2.toFront();
            }
        });
        //f.add(front);
View Full Code Here


    Frame f = new Frame("AWT Menu Test");
    MenuBar mb = new MenuBar();
    Menu m = new Menu("Menu 1");
    mb.add(m);
    f.setMenuBar(mb);
    f.add(new Button("Button"));
    f.pack();
    MenuItem itemA = new MenuItem("Item A");
    m.insert(itemA, 0);
    MenuItem itemB = new MenuItem("Item B");
    m.insert(itemB, 0);
View Full Code Here

  public void test(TestHarness harness)
  {
    GridBagLayout gbl = new GridBagLayout();
    harness.check(gbl.toString(), "java.awt.GridBagLayout");
   
    gbl.addLayoutComponent("String", new Button("Button"));
    harness.check(gbl.toString(), "java.awt.GridBagLayout");
  }
View Full Code Here

  public void test2(TestHarness harness)
  {
    ScrollPane pane = new ScrollPane();
   
    // Add a component (i.e. child) to the scrollpane.
    Button button = new Button();
    pane.add(button);
    harness.check(pane.getComponentCount(), 1);
    harness.check(pane.getComponent(0), button);
   
    // Check default scroll position.
View Full Code Here

  }
 
  public void test3(TestHarness harness)
  {
    ScrollPane pane = new ScrollPane();
    pane.add(new Button());
   
    // Check that setScrollPosition(int, int) and
    // setScrollPosition(Point) return the same values.
    pane.setScrollPosition(1, 1);
    harness.check(pane.getScrollPosition(), new Point(0, 0));
View Full Code Here

  }
 
  public void test4(TestHarness harness)
  {
    ScrollPane pane = new ScrollPane();
    pane.add(new Button());

    // Check that if x or y < 0, x and y are set to 0.
    pane.setScrollPosition(-1, -1);
    harness.check(pane.getScrollPosition(), new Point());
    pane.setScrollPosition(0, 0);
View Full Code Here

  }
 
  public void test5(TestHarness harness)
  {
    ScrollPane pane = new ScrollPane();
    Button button = new Button();
    button.setSize(100, 100);
    pane.add(button);
    harness.check(pane.getComponent(0).getWidth(), 100);
    harness.check(pane.getComponent(0).getHeight(), 100);
    harness.check(pane.getViewportSize().getWidth(), 100);
    harness.check(pane.getViewportSize().getHeight(), 100);
View Full Code Here

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

    harness.check(layout.minimumLayoutSize(container), new Dimension(10, 10));
   
    // Show that the width is calculated using the formula:
    //   w += (num + 1) * hgap + ins.left + ins.right;
    // when there is one or more components in container.
    container.add(new Button());
    harness.check(layout.minimumLayoutSize(container), new Dimension(10, 10));
    container.add(new Button());
    container.add(new List());
    harness.check(layout.minimumLayoutSize(container), new Dimension(20, 10));
  }
View Full Code Here

      }
    }
   
    public void actionPerformed(ActionEvent e)
    {
      Button b = (Button) e.getSource();
      b.setLabel("");
      source.setText("Drag and drop me to the following Button");
      actionPerformed = true;
    }
View Full Code Here

TOP

Related Classes of java.awt.Button$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.