本文整理汇总了Java中javax.swing.Box.createRigidArea方法的典型用法代码示例。如果您正苦于以下问题:Java Box.createRigidArea方法的具体用法?Java Box.createRigidArea怎么用?Java Box.createRigidArea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.Box
的用法示例。
在下文中一共展示了Box.createRigidArea方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeAreas
import javax.swing.Box; //导入方法依赖的package包/类
private void initializeAreas() {
Component verticalStrut_2 = Box.createVerticalStrut(20);
GridBagConstraints gbc_verticalStrut_2 = new GridBagConstraints();
gbc_verticalStrut_2.insets = new Insets(0, 0, 5, 0);
gbc_verticalStrut_2.gridx = 10;
gbc_verticalStrut_2.gridy = 0;
this.panelFirst.add(verticalStrut_2, gbc_verticalStrut_2);
Component rigidArea_9 = Box.createRigidArea(new Dimension(20, 20));
GridBagConstraints gbc_rigidArea_9 = new GridBagConstraints();
gbc_rigidArea_9.insets = new Insets(0, 0, 5, 5);
gbc_rigidArea_9.gridx = 0;
gbc_rigidArea_9.gridy = 1;
this.panelFirst.add(rigidArea_9, gbc_rigidArea_9);
Component horizontalStrut_3 = Box.createHorizontalStrut(20);
GridBagConstraints gbc_horizontalStrut_3 = new GridBagConstraints();
gbc_horizontalStrut_3.insets = new Insets(0, 0, 5, 5);
gbc_horizontalStrut_3.gridx = 7;
gbc_horizontalStrut_3.gridy = 1;
this.panelFirst.add(horizontalStrut_3, gbc_horizontalStrut_3);
Component rigidArea_10 = Box.createRigidArea(new Dimension(20, 20));
GridBagConstraints gbc_rigidArea_10 = new GridBagConstraints();
gbc_rigidArea_10.insets = new Insets(0, 0, 5, 5);
gbc_rigidArea_10.gridx = 9;
gbc_rigidArea_10.gridy = 1;
this.panelFirst.add(rigidArea_10, gbc_rigidArea_10);
Component verticalStrut_5 = Box.createVerticalStrut(20);
GridBagConstraints gbc_verticalStrut_5 = new GridBagConstraints();
gbc_verticalStrut_5.insets = new Insets(0, 0, 5, 5);
gbc_verticalStrut_5.gridx = 8;
gbc_verticalStrut_5.gridy = 2;
this.panelFirst.add(verticalStrut_5, gbc_verticalStrut_5);
Component horizontalStrut_2 = Box.createHorizontalStrut(20);
GridBagConstraints gbc_horizontalStrut_2 = new GridBagConstraints();
gbc_horizontalStrut_2.insets = new Insets(0, 0, 0, 5);
gbc_horizontalStrut_2.gridx = 5;
gbc_horizontalStrut_2.gridy = 3;
this.panelFirst.add(horizontalStrut_2, gbc_horizontalStrut_2);
Component rigidArea_4 = Box.createRigidArea(new Dimension(20, 20));
GridBagConstraints gbc_rigidArea_4 = new GridBagConstraints();
gbc_rigidArea_4.insets = new Insets(0, 0, 5, 5);
gbc_rigidArea_4.gridx = 2;
gbc_rigidArea_4.gridy = 1;
this.panelSecond.add(rigidArea_4, gbc_rigidArea_4);
Component rigidArea_7 = Box.createRigidArea(new Dimension(20, 20));
GridBagConstraints gbc_rigidArea_7 = new GridBagConstraints();
gbc_rigidArea_7.insets = new Insets(0, 0, 5, 5);
gbc_rigidArea_7.gridx = 3;
gbc_rigidArea_7.gridy = 2;
this.panelSecond.add(rigidArea_7, gbc_rigidArea_7);
Component horizontalStrut_4 = Box.createHorizontalStrut(20);
GridBagConstraints gbc_horizontalStrut_4 = new GridBagConstraints();
gbc_horizontalStrut_4.insets = new Insets(0, 0, 5, 0);
gbc_horizontalStrut_4.gridx = 8;
gbc_horizontalStrut_4.gridy = 2;
this.panelSecond.add(horizontalStrut_4, gbc_horizontalStrut_4);
Component rigidArea_5 = Box.createRigidArea(new Dimension(20, 20));
GridBagConstraints gbc_rigidArea_5 = new GridBagConstraints();
gbc_rigidArea_5.insets = new Insets(0, 0, 5, 5);
gbc_rigidArea_5.gridx = 2;
gbc_rigidArea_5.gridy = 3;
this.panelSecond.add(rigidArea_5, gbc_rigidArea_5);
Component rigidArea_3 = Box.createRigidArea(new Dimension(20, 20));
GridBagConstraints gbc_rigidArea_3 = new GridBagConstraints();
gbc_rigidArea_3.insets = new Insets(0, 0, 0, 5);
gbc_rigidArea_3.gridx = 0;
gbc_rigidArea_3.gridy = 5;
this.panelSecond.add(rigidArea_3, gbc_rigidArea_3);
}
示例2: createPaddingComponent
import javax.swing.Box; //导入方法依赖的package包/类
/**
* Creates a padding component.
*
* @param horizontalPadding determines whether we are interested in horizontal padding.
* @param verticalPadding determines whether we are interested in vertical padding.
* @param paddingSize determines padding component size in pixels.
* @return new padding component.
*/
private static Component createPaddingComponent(boolean horizontalPadding, boolean verticalPadding, int paddingSize) {
Dimension dim = new Dimension(horizontalPadding ? paddingSize : 0, verticalPadding ? paddingSize : 0);
JComponent padding = (JComponent)Box.createRigidArea(dim);
padding.putClientProperty(PADDING_COMPONENT, Boolean.TRUE);
return padding;
}