Package javax.swing

Examples of javax.swing.JPanel.doLayout()


    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
   
    JPanel panel = new JPanel(new BorderLayout());
    panel.setSize(100, 20);
    panel.add(scrollBar);
    panel.doLayout();
    harness.check(ui.getTrackBounds(), new Rectangle(0, 0, 0, 0));
    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
   
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(16, 0, 68, 20));   
View Full Code Here


    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
   
    JPanel panel = new JPanel(new BorderLayout());
    panel.setSize(100, 20);
    panel.add(scrollBar);
    panel.doLayout();
    harness.check(ui.getTrackBounds(), new Rectangle(0, 0, 0, 0));
    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
   
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(15, 0, 69, 20));   
View Full Code Here

    container.setSize(100, 200);
    BoxLayout layout = new BoxLayout(container, BoxLayout.Y_AXIS);
    container.setLayout(layout);
    JSeparator s1 = new JSeparator();
    container.add(s1);
    container.doLayout();
    harness.check(layout.preferredLayoutSize(container), new Dimension(0, 2));
  }


}
View Full Code Here

    public void testCanDock() {
        JPanel panel = new JPanel();
        panel.add(toolBar);
        panel.setSize(400, 300);
        panel.doLayout();
        assertTrue(ui.canDock(panel, new Point(panel.getWidth() / 2, toolBar.getHeight() - 1)));
        assertTrue(ui.canDock(panel, new Point(panel.getWidth() / 2, panel.getHeight()
                - (toolBar.getHeight() - 1))));
        assertTrue(ui.canDock(panel, new Point(toolBar.getHeight() - 1, panel.getHeight() / 2)));
        assertTrue(ui.canDock(panel, new Point(panel.getWidth() - (toolBar.getHeight() - 1),
View Full Code Here

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        serialize(out, panel);
        byte[] bytes = out.toByteArray();
        InputStream in = new ByteArrayInputStream(bytes);
        JPanel panel2 = (JPanel) deserialize(in);
        panel2.doLayout();
    }


    // Helper Code *********************************************************

 
View Full Code Here

        CellConstraints cc = new CellConstraints();
        panel.add(new JLabel("Test1"),  cc.xy(1, 1, "l, t"));
        panel.add(new JButton("Test2"), cc.xy(2, 2, "c, c"));
        panel.add(new JButton("Test3"), cc.xy(3, 3, "r, b"));
        panel.add(new JButton("Test4"), cc.xy(4, 4, "f, f"));
        panel.doLayout();
        return panel;
    }


    /**
 
View Full Code Here

     * @param layout    the FormLayout used to lay out
     * @return the layout info after the container has been laid out
     */
    private FormLayout.LayoutInfo doLayout(FormLayout layout) {
        JPanel panel = new JPanel(layout);
        panel.doLayout();
        FormLayout.LayoutInfo info = layout.getLayoutInfo(panel);
        return info;
    }


View Full Code Here

        FormLayout layout = new FormLayout(
            "1px, 2px, 3px, 5px, 7px",
            "1px, 2px, 3px");

        JPanel panel = new JPanel(layout);
        panel.doLayout();
        FormLayout.LayoutInfo info = layout.getLayoutInfo(panel);
        assertEquals("Columns",   6, info.columnOrigins.length);
        assertEquals("Rows",      4, info.rowOrigins.length);
        assertEquals("Column 0"0, info.columnOrigins[0]);
        assertEquals("Column 1"1, info.columnOrigins[1]);
View Full Code Here

        panel.add(center, cc.xy(2, 1));
        panel.add(right,  cc.xy(3, 1));
        panel.add(fill,   cc.xy(4, 1));
        panel.add(def,    cc.xy(5, 1));

        panel.doLayout();

        assertEquals("Left.x",         0, left.getX());
        assertEquals("Left.width",     4, left.getWidth());
        assertEquals("Center.x",      13, center.getX());
        assertEquals("Center.width",   4, center.getWidth());
View Full Code Here

        panel.add(center,  cc.xy(1, 2));
        panel.add(bottom,  cc.xy(1, 3));
        panel.add(fill,    cc.xy(1, 4));
        panel.add(def,     cc.xy(1, 5));

        panel.doLayout();

        assertEquals("Top.y",           0, top.getY());
        assertEquals("Top.height",      4, top.getHeight());
        assertEquals("Center.y",       13, center.getY());
        assertEquals("Center.height",   4, center.getHeight());
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.