当前位置: 首页>>代码示例>>Java>>正文


Java Constraints.setY方法代码示例

本文整理汇总了Java中javax.swing.SpringLayout.Constraints.setY方法的典型用法代码示例。如果您正苦于以下问题:Java Constraints.setY方法的具体用法?Java Constraints.setY怎么用?Java Constraints.setY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.SpringLayout.Constraints的用法示例。


在下文中一共展示了Constraints.setY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testConstraints_SetHeight

import javax.swing.SpringLayout.Constraints; //导入方法依赖的package包/类
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);
    layout.layoutContainer(container);

    assertEquals(300, container.getHeight());
    assertEquals(8, button.getHeight());
    assertEquals(8, textField.getHeight());
    assertEquals(6, panel.getHeight());
    assertEquals(0, innerButton.getHeight());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:SpringLayoutTest.java

示例2: testConstraints_SetY

import javax.swing.SpringLayout.Constraints; //导入方法依赖的package包/类
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);
    layout.layoutContainer(container);

    assertEquals(0, container.getY());
    assertEquals(8, button.getY());
    assertEquals(20, textField.getY());
    assertEquals(6, panel.getY());
    assertEquals(0, innerButton.getY());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:SpringLayoutTest.java

示例3: testConstraints_GetHeight

import javax.swing.SpringLayout.Constraints; //导入方法依赖的package包/类
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);
    layout.layoutContainer(container);

    SpringTest.assertSizes(5, 5, 5,
                           layout.getConstraints(container).getHeight());
    SpringTest.assertSizes(8, 8, 8,
                           layout.getConstraints(button).getHeight());
    SpringTest.assertSizes(8, 8, 8,
                           layout.getConstraints(textField).getHeight());
    SpringTest.assertSizes(6, 6, 6,
                           layout.getConstraints(panel).getHeight());
    SpringTest.assertSizes(15, 15, 15,
                           layout.getConstraints(innerButton).getHeight());

    container.setSize(200, 300);
    layout.layoutContainer(button);
    SpringTest.assertSizes(8, 8, 8,
                           layout.getConstraints(button).getHeight());

}
 
开发者ID:shannah,项目名称:cn1,代码行数:37,代码来源:SpringLayoutTest.java

示例4: testConstraints_GetY

import javax.swing.SpringLayout.Constraints; //导入方法依赖的package包/类
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);
    layout.layoutContainer(container);

    SpringTest.assertSizes(0, 0, 0,
                           layout.getConstraints(container).getY());
    SpringTest.assertSizes(8, 8, 8,
                           layout.getConstraints(button).getY());
    SpringTest.assertSizes(20, 20, 20,
                           layout.getConstraints(textField).getY());
    SpringTest.assertSizes(6, 6, 6,
                           layout.getConstraints(panel).getY());
    SpringTest.assertSizes(15, 15, 15,
                           layout.getConstraints(innerButton).getY());

    container.setSize(200, 300);
    layout.layoutContainer(button);
    SpringTest.assertSizes(0, 0, 0, layout.getConstraints(button).getY());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:35,代码来源:SpringLayoutTest.java


注:本文中的javax.swing.SpringLayout.Constraints.setY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。