Package javax.swing.SpringLayout

Examples of javax.swing.SpringLayout.Constraints


        SpringTest.assertSizes(1, 2, 3, 2, constraints.getWidth());
        SpringTest.assertSizes(11, 12, 13, 12, constraints.getHeight());
    }

    public void testConstraints_SetConstraint() throws Exception {
        Constraints constraints;
        layout.getConstraints(container).setConstraint(SpringLayout.WEST,
                                                      Spring.constant(5));

        layout.getConstraints(button).setConstraint(SpringLayout.WEST,
                                                    Spring.constant(6));
        layout.getConstraints(button).setX(Spring.constant(7));

        constraints = layout.getConstraints(textField);
        constraints.setX(Spring.constant(8));
        constraints.setWidth(Spring.constant(10));
        constraints.setConstraint(SpringLayout.EAST, Spring.constant(30));

        layout.getConstraints(panel).setConstraint(SpringLayout.WEST,
                                                   Spring.constant(7));
        constraints.setWidth(Spring.constant(20));
        layout.getConstraints(panel).setConstraint(SpringLayout.EAST,
                                                   Spring.constant(17));

        constraints = layout.getConstraints(innerButton);
        constraints.setX(Spring.constant(18));
        constraints.setWidth(Spring.constant(20));
        constraints.setConstraint(SpringLayout.EAST, Spring.constant(50));

        container.setSize(200, 300);
        layout.layoutContainer(container);

        assertEdges(layout.getConstraints(container),
View Full Code Here


        assertEdges(layout.getConstraints(component),
                    0, 10, 0, 5);
    }

    public void testConstraints_GetConstraint() throws Exception {
        Constraints constraints;
        layout.getConstraints(container).setConstraint(SpringLayout.WEST,
                                                      Spring.constant(5));

        layout.getConstraints(button).setConstraint(SpringLayout.WEST,
                                                    Spring.constant(6));
        layout.getConstraints(button).setX(Spring.constant(7));

        constraints = layout.getConstraints(textField);
        constraints.setX(Spring.constant(8));
        constraints.setWidth(Spring.constant(10));
        constraints.setConstraint(SpringLayout.EAST, Spring.constant(30));

        layout.getConstraints(panel).setConstraint(SpringLayout.WEST,
                                                   Spring.constant(7));
        constraints.setWidth(Spring.constant(20));
        layout.getConstraints(panel).setConstraint(SpringLayout.EAST,
                                                   Spring.constant(17));

        constraints = layout.getConstraints(innerButton);
        constraints.setX(Spring.constant(18));
        constraints.setWidth(Spring.constant(20));
        constraints.setConstraint(SpringLayout.EAST, Spring.constant(50));

        container.setSize(200, 300);
        layout.layoutContainer(container);

        constraints = layout.getConstraints(container);
        SpringTest.assertSizes(0, 0, 0, 0,
                               constraints.getConstraint(SpringLayout.WEST));
        SpringTest.assertSizes(0, 0, Integer.MAX_VALUE, 200,
                               constraints.getConstraint(SpringLayout.EAST));

        constraints = layout.getConstraints(button);
        Spring west = constraints.getConstraint(SpringLayout.WEST);
        Spring east = constraints.getConstraint(SpringLayout.EAST);
        SpringTest.assertSizes(7, 7, 7, 7, west);
        SpringTest.assertSizes(9, 12, 107, 12, east);

        constraints.setConstraint(SpringLayout.WEST,
                                  Spring.constant(200));
        constraints.setConstraint(SpringLayout.EAST,
                                  Spring.constant(100));
        constraints.setWidth(Spring.constant(7));
        layout.layoutContainer(container);
        SpringTest.assertSizes(7, 7, 7, 7, west);
        SpringTest.assertSizes(9, 12, 107, 12, east);

        constraints.getConstraint("wrong value");

        constraints = layout.getConstraints(innerButton);
        west = constraints.getConstraint(SpringLayout.WEST);
        east = constraints.getConstraint(SpringLayout.EAST);
        SpringTest.assertSizes(30, 30, 30, 30, west);
        SpringTest.assertSizes(50, 50, 50, 50, east);

        constraints = new SpringLayout.Constraints();
        constraints.setConstraint(SpringLayout.EAST,
                                  Spring.constant(5));
        assertNull(constraints.getConstraint(SpringLayout.WEST));
        SpringTest.assertSizes(5, 5, 5,
                               constraints.getConstraint(SpringLayout.EAST));
        assertNull(constraints.getWidth());

        constraints.setY(Spring.constant(3));
        SpringTest.assertSizes(3, 3, 3, constraints.getY());
        SpringTest.assertSizes(3, 3, 3,
                               constraints.getConstraint(SpringLayout.NORTH));
        assertNull(constraints.getConstraint(SpringLayout.SOUTH));

        constraints = new SpringLayout.Constraints();
        constraints.setHeight(Spring.constant(3));
        assertNull(constraints.getY());
        assertNull(constraints.getConstraint(SpringLayout.SOUTH));
        assertNull(constraints.getConstraint(SpringLayout.NORTH));

        constraints = new SpringLayout.Constraints(Spring.constant(1),
                                                   Spring.constant(2));
        constraints.setWidth(Spring.constant(10));
        SpringTest.assertSizes(11, 11, 11,
                               constraints.getConstraint(SpringLayout.EAST));

    }
View Full Code Here

    public void testConstraints_SetHeight() throws Exception {
        layout.getConstraints(container).setHeight(Spring.constant(5));
        layout.getConstraints(button).setHeight(Spring.constant(6));
        layout.getConstraints(button).setHeight(Spring.constant(8));

        Constraints constraints = layout.getConstraints(textField);
        constraints.setHeight(Spring.constant(8));
        constraints.setY(Spring.constant(10));
        constraints.setConstraint(SpringLayout.EAST, Spring.constant(40));

        layout.getConstraints(panel).setHeight(Spring.constant(6));
        constraints.setY(Spring.constant(20));


        layout.getConstraints(innerButton).setHeight(Spring.constant(15));

        container.setSize(200, 300);
View Full Code Here

    public void testConstraints_GetHeight() throws Exception {
        layout.getConstraints(container).setHeight(Spring.constant(5));
        layout.getConstraints(button).setHeight(Spring.constant(6));
        layout.getConstraints(button).setHeight(Spring.constant(8));

        Constraints constraints = layout.getConstraints(textField);
        constraints.setHeight(Spring.constant(8));
        constraints.setY(Spring.constant(10));
        constraints.setConstraint(SpringLayout.EAST, Spring.constant(40));

        layout.getConstraints(panel).setHeight(Spring.constant(6));
        constraints.setY(Spring.constant(20));


        layout.getConstraints(innerButton).setHeight(Spring.constant(15));

        container.setSize(200, 300);
View Full Code Here

    public void testConstraints_SetWidth() throws Exception {
        layout.getConstraints(container).setWidth(Spring.constant(5));
        layout.getConstraints(button).setWidth(Spring.constant(6));
        layout.getConstraints(button).setWidth(Spring.constant(8));

        Constraints constraints = layout.getConstraints(textField);
        constraints.setWidth(Spring.constant(8));
        constraints.setX(Spring.constant(10));
        constraints.setConstraint(SpringLayout.EAST, Spring.constant(40));

        layout.getConstraints(panel).setWidth(Spring.constant(6));
        constraints.setX(Spring.constant(20));


        layout.getConstraints(innerButton).setWidth(Spring.constant(15));

        container.setSize(200, 300);
View Full Code Here

    public void testConstraints_GetWidth() throws Exception {
        layout.getConstraints(container).setWidth(Spring.constant(5));
        layout.getConstraints(button).setWidth(Spring.constant(6));
        layout.getConstraints(button).setWidth(Spring.constant(8));

        Constraints constraints = layout.getConstraints(textField);
        constraints.setWidth(Spring.constant(8));
        constraints.setX(Spring.constant(10));
        constraints.setConstraint(SpringLayout.EAST, Spring.constant(40));

        layout.getConstraints(panel).setWidth(Spring.constant(6));
        constraints.setX(Spring.constant(20));


        layout.getConstraints(innerButton).setWidth(Spring.constant(15));

        container.setSize(200, 300);
View Full Code Here

    public void testConstraints_SetX() throws Exception {
        layout.getConstraints(container).setX(Spring.constant(5));
        layout.getConstraints(button).setX(Spring.constant(6));
        layout.getConstraints(button).setX(Spring.constant(7));

        Constraints constraints = layout.getConstraints(textField);
        constraints.setX(Spring.constant(8));
        constraints.setWidth(Spring.constant(10));
        constraints.setConstraint(SpringLayout.EAST, Spring.constant(30));

        layout.getConstraints(panel).setX(Spring.constant(7));
        constraints.setWidth(Spring.constant(20));


        layout.getConstraints(innerButton).setX(Spring.constant(17));

        container.setSize(200, 300);
View Full Code Here

    public void testConstraints_GetX() throws Exception {
        layout.getConstraints(container).setX(Spring.constant(5));
        layout.getConstraints(button).setX(Spring.constant(6));
        layout.getConstraints(button).setX(Spring.constant(7));

        Constraints constraints = layout.getConstraints(textField);
        constraints.setX(Spring.constant(8));
        constraints.setWidth(Spring.constant(10));
        constraints.setConstraint(SpringLayout.EAST, Spring.constant(30));

        layout.getConstraints(panel).setX(Spring.constant(7));
        constraints.setWidth(Spring.constant(20));


        layout.getConstraints(innerButton).setX(Spring.constant(17));

        container.setSize(200, 300);
View Full Code Here

    public void testConstraints_SetY() throws Exception {
        layout.getConstraints(container).setY(Spring.constant(5));
        layout.getConstraints(button).setY(Spring.constant(6));
        layout.getConstraints(button).setY(Spring.constant(8));

        Constraints constraints = layout.getConstraints(textField);
        constraints.setY(Spring.constant(8));
        constraints.setHeight(Spring.constant(10));
        constraints.setConstraint(SpringLayout.SOUTH, Spring.constant(40));

        layout.getConstraints(panel).setY(Spring.constant(6));
        constraints.setHeight(Spring.constant(20));


        layout.getConstraints(innerButton).setY(Spring.constant(15));

        container.setSize(200, 300);
View Full Code Here

    public void testConstraints_GetY() throws Exception {
        layout.getConstraints(container).setY(Spring.constant(5));
        layout.getConstraints(button).setY(Spring.constant(6));
        layout.getConstraints(button).setY(Spring.constant(8));

        Constraints constraints = layout.getConstraints(textField);
        constraints.setY(Spring.constant(8));
        constraints.setHeight(Spring.constant(10));
        constraints.setConstraint(SpringLayout.SOUTH, Spring.constant(40));

        layout.getConstraints(panel).setY(Spring.constant(6));
        constraints.setHeight(Spring.constant(20));


        layout.getConstraints(innerButton).setY(Spring.constant(15));

        container.setSize(200, 300);
View Full Code Here

TOP

Related Classes of javax.swing.SpringLayout.Constraints

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.