下面列出了javax.swing.border.Border#getClass ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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;
}
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;
}
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;
}
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;
}
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());
}
}
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;
}
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());
}
}
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;
}
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;
}
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());
}
}
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;
}
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());
}
}
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());
}
}
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;
}