Package java.awt

Examples of java.awt.Frame.pack()


    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;
View Full Code Here


    Frame f = new Frame();
    Choice c = new Choice();
    c.setBackground(Color.blue);
    add(c);
    f.add(this);
    f.pack();
    f.show();
    Rectangle bounds = c.getBounds();
    Insets i = f.getInsets();
    Point loc = f.getLocationOnScreen();
    bounds.x += i.left + loc.x;
View Full Code Here

    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;
View Full Code Here

    c.add("1");
    c.add("2");
    c.add("3");
    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;
View Full Code Here

    list.add("item1");
    list.select(1);
    list.select(0);
    Frame f = new Frame("");
    f.add(list);
    f.pack();
    harness.check(list.getSelectedIndex(), -1);
    list.setMultipleMode(false);
    harness.check(list.getSelectedIndex(), 0);
    harness.check(list.isMultipleMode(), false);
    harness.check(list.getSelectedIndex(), 0);
View Full Code Here

    r = harness.createRobot();
    myPanel p = new myPanel();
    p.add(new List(10));
    Frame f = new Frame();
    f.add(p);
    f.pack();
    f.show();
   
    // There is a delay to avoid any race conditions.   
    r.waitForIdle();
    r.delay(1000);
View Full Code Here

    setBackground(Color.red);
    Frame f = new Frame();
    TextArea c = new TextArea("", 2, 20, TextArea.SCROLLBARS_VERTICAL_ONLY);
    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;
View Full Code Here

    Frame f = new Frame();
    Checkbox c = new Checkbox("check!");
    c.setBackground(Color.blue);
    add(c);
    f.add(this);
    f.pack();
    f.show();
    Point loc = f.getLocationOnScreen();
    Rectangle bounds = c.getBounds();
    Insets i = f.getInsets();
    bounds.x += i.left + loc.x;
View Full Code Here

    Frame f = new Frame();
    TextField b = new TextField(10);
    b.setBackground(Color.WHITE);
    add(b);
    f.add(this);
    f.pack();
    f.show();
    Rectangle bounds = b.getBounds();
    Point loc = f.getLocationOnScreen();
    Insets i = f.getInsets();
    bounds.x += loc.x + i.left;
View Full Code Here

        bw.init();
        Frame frame = new JFrame("BoxWorld");
        frame.setResizable(false);
        frame.add(bw);
        frame.addWindowListener(bw);
        frame.pack();
        frame.setSize(400, 400);
        frame.setLocation(40, 40);
        frame.setVisible(true);
        bw.requestFocus();
        // frame.setVisible(true);
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.