本文整理汇总了Java中com.jgoodies.forms.layout.Sizes.constant方法的典型用法代码示例。如果您正苦于以下问题:Java Sizes.constant方法的具体用法?Java Sizes.constant怎么用?Java Sizes.constant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jgoodies.forms.layout.Sizes
的用法示例。
在下文中一共展示了Sizes.constant方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEmptyBorder
import com.jgoodies.forms.layout.Sizes; //导入方法依赖的package包/类
public static Border createEmptyBorder(String encodedSizes) {
String token[] = encodedSizes.split("\\s*,\\s*");
int tokenCount = token.length;
if (token.length != 4) {
throw new IllegalArgumentException((new StringBuilder()).append(
"The border requires 4 sizes, but \"").append(encodedSizes)
.append("\" has ").append(tokenCount).append(".")
.toString());
} else {
ConstantSize top = Sizes.constant(token[0], false);
ConstantSize left = Sizes.constant(token[1], true);
ConstantSize bottom = Sizes.constant(token[2], false);
ConstantSize right = Sizes.constant(token[3], true);
return createEmptyBorder(top, left, bottom, right);
}
}
示例2: createEmptyBorder
import com.jgoodies.forms.layout.Sizes; //导入方法依赖的package包/类
/**
* Creates and returns a <code>Border</code> using sizes as specified by
* the given string. This string is a comma-separated encoding of
* 4 <code>ConstantSize</code>s.
*
* @param encodedSizes top, left, bottom, right gap encoded as String
* @return an <code>EmptyBorder</code> with the specified gaps
*
* @see #createEmptyBorder(ConstantSize, ConstantSize, ConstantSize, ConstantSize)
*/
public static Border createEmptyBorder(String encodedSizes) {
String[] token = encodedSizes.split("\\s*,\\s*");
int tokenCount = token.length;
if (token.length != 4) {
throw new IllegalArgumentException(
"The border requires 4 sizes, but \"" + encodedSizes +
"\" has " + tokenCount + ".");
}
ConstantSize top = Sizes.constant(token[0], false);
ConstantSize left = Sizes.constant(token[1], true);
ConstantSize bottom = Sizes.constant(token[2], false);
ConstantSize right = Sizes.constant(token[3], true);
return createEmptyBorder(top, left, bottom, right);
}
示例3: createPadding
import com.jgoodies.forms.layout.Sizes; //导入方法依赖的package包/类
/**
* Creates and returns a padding (an instance of {@link EmptyBorder})
* using sizes as specified by the given string.
* This string is a comma-separated encoding of 4 {@code ConstantSize}s.
*
* @param encodedSizes top, left, bottom, right gap encoded as String
* @param args optional format arguments,
* used if {@code encodedSizes} is a format string
* @return a padding with the specified margins
*
* @see #createPadding(ConstantSize, ConstantSize, ConstantSize, ConstantSize)
*/
public static Padding createPadding(String encodedSizes, Object... args) {
String formattedSizes = Strings.get(encodedSizes, args);
String[] token = formattedSizes.split("\\s*,\\s*");
int tokenCount = token.length;
checkArgument(token.length == 4,
"The padding requires 4 sizes, but \"%s\" has %d.", formattedSizes, Integer.valueOf(tokenCount));
ConstantSize top = Sizes.constant(token[0]);
ConstantSize left = Sizes.constant(token[1]);
ConstantSize bottom = Sizes.constant(token[2]);
ConstantSize right = Sizes.constant(token[3]);
return createPadding(top, left, bottom, right);
}
示例4: parseGeneralSetting
import com.jgoodies.forms.layout.Sizes; //导入方法依赖的package包/类
@Override Object parseGeneralSetting(Context c) { return Sizes.constant(c.input, false); }