本文整理汇总了Java中javax.swing.border.Border.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java Border.getClass方法的具体用法?Java Border.getClass怎么用?Java Border.getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.border.Border
的用法示例。
在下文中一共展示了Border.getClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import javax.swing.border.Border; //导入方法依赖的package包/类
private static void test(Border border) {
Insets actual = border.getBorderInsets(null);
if (NEGATIVE.equals(actual)) {
throw new Error("unexpected insets in " + border.getClass());
}
Insets expected = (Insets) actual.clone();
// modify
actual.top++;
actual.left++;
actual.right++;
actual.bottom++;
// validate
if (!expected.equals(border.getBorderInsets(null))) {
throw new Error("shared insets in " + border.getClass());
}
}
示例2: test
import javax.swing.border.Border; //导入方法依赖的package包/类
private static void test(Border border, Insets insets) {
Insets result = border.getBorderInsets(getComponent(border));
if (insets == result) {
throw new Error("both instances are the same for " + border.getClass());
}
if (!insets.equals(result)) {
throw new Error("both insets are not equal for " + border.getClass());
}
}
示例3: getComponent
import javax.swing.border.Border; //导入方法依赖的package包/类
private static JComponent getComponent(Border border) {
Class type = border.getClass();
if (type.equals(MotifBorders.MotifPopupMenuBorder.class)) {
return POPUP;
}
if (type.equals(WindowsBorders.ToolBarBorder.class)) {
return TOOLBAR;
}
if (type.equals(MetalBorders.ToolBarBorder.class)) {
return TOOLBAR;
}
return LABEL;
}