Java 类javax.swing.border.AbstractBorder 实例源码

项目:SmartTokens    文件:TableHeaderUtils.java   
/**
 * Creates a {@link Border} that paints any empty space to the right of the last column header
 * in the given {@link JTable}'s {@link JTableHeader}.
 */
private static Border createTableHeaderEmptyColumnPainter(final JTable table) {
    return new AbstractBorder() {
        @Override
        public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
            // if this JTableHeader is parented in a JViewport, then paint the table header
            // background to the right of the last column if neccessary.
            JViewport viewport = (JViewport) table.getParent();
            if (viewport != null && table.getWidth() < viewport.getWidth()) {
                int startX = table.getWidth();
                int emptyColumnWidth = viewport.getWidth() - table.getWidth();
                paintHeader(g, table, startX, emptyColumnWidth);
            }
        }
    };
}
项目:cn1    文件:JComponent.java   
public Insets getInsets(Insets insets) {
    Border border = getBorder();
    if (border instanceof AbstractBorder && insets != null) {
        return ((AbstractBorder) border).getBorderInsets(this, insets);
    }
    Insets originalInsets;
    if (border == null) {
        originalInsets = super.getInsets();
    } else {
        originalInsets = border.getBorderInsets(this);
    }
    if (insets != null) {
        insets.set(originalInsets.top, originalInsets.left, originalInsets.bottom,
                originalInsets.right);
        return insets;
    }
    return originalInsets;
}
项目:MediathekView    文件:TableHeaderUtils.java   
/**
 * Creates a {@link Border} that paints any empty space to the right of the last column header
 * in the given {@link JTable}'s {@link JTableHeader}.
 */
@SuppressWarnings("serial")
private static Border createTableHeaderEmptyColumnPainter(final JTable table) {
    return new AbstractBorder() {
        @Override
        public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
            // if this JTableHeader is parented in a JViewport, then paint the table header
            // background to the right of the last column if neccessary.
            JViewport viewport = (JViewport) table.getParent();
            if (viewport != null && table.getWidth() < viewport.getWidth()) {
                int startX = table.getWidth();
                int emptyColumnWidth = viewport.getWidth() - table.getWidth();
                paintHeader(g, table, startX, emptyColumnWidth);
            }
        }
    };
}
项目:freeVM    文件:JComponent.java   
public Insets getInsets(Insets insets) {
    Border border = getBorder();
    if (border instanceof AbstractBorder && insets != null) {
        return ((AbstractBorder) border).getBorderInsets(this, insets);
    }
    Insets originalInsets;
    if (border == null) {
        originalInsets = super.getInsets();
    } else {
        originalInsets = border.getBorderInsets(this);
    }
    if (insets != null) {
        insets.set(originalInsets.top, originalInsets.left, originalInsets.bottom,
                originalInsets.right);
        return insets;
    }
    return originalInsets;
}
项目:freeVM    文件:JComponent.java   
public Insets getInsets(Insets insets) {
    Border border = getBorder();
    if (border instanceof AbstractBorder && insets != null) {
        return ((AbstractBorder) border).getBorderInsets(this, insets);
    }
    Insets originalInsets;
    if (border == null) {
        originalInsets = super.getInsets();
    } else {
        originalInsets = border.getBorderInsets(this);
    }
    if (insets != null) {
        insets.set(originalInsets.top, originalInsets.left, originalInsets.bottom,
                originalInsets.right);
        return insets;
    }
    return originalInsets;
}
项目:jdk8u-jdk    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:jdk8u-jdk    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:openjdk-jdk10    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:openjdk-jdk10    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:openjdk9    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:openjdk9    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:jdk8u_jdk    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:jdk8u_jdk    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:lookaside_java-1.8.0-openjdk    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:swingx    文件:TableAddon.java   
/**
     * @param defaults
     * @param componentPrefix
     * @param borderKey
     */
    private void replaceBorder(DefaultsList defaults, String componentPrefix,
            String borderKey) {
        String key = componentPrefix + borderKey;
        Border border = UIManager.getBorder(componentPrefix + borderKey);
        if (border instanceof AbstractBorder && border instanceof UIResource
                && border.getClass().getName().contains("ListTable")) {
            border = new SafeBorder((AbstractBorder) border);
            // PENDING JW: this is fishy ... adding to lookAndFeelDefaults is taken
            UIManager.getLookAndFeelDefaults().put(key, border);
            // adding to defaults is not
//            defaults.add(key, border);

        }
    }
项目:swingx    文件:XListAddon.java   
/**
     * @param defaults
     * @param componentPrefix
     * @param borderKey
     */
    private void replaceBorder(DefaultsList defaults, String componentPrefix,
            String borderKey) {
        String key = componentPrefix + borderKey;
        Border border = UIManager.getBorder(componentPrefix + borderKey);
        if (border instanceof AbstractBorder && border instanceof UIResource
                && border.getClass().getName().contains("ListTable")) {
            border = new SafeBorder((AbstractBorder) border);
            // PENDING JW: this is fishy ... adding to lookAndFeelDefaults is taken
            UIManager.getLookAndFeelDefaults().put(key, border);
            // adding to defaults is not
//            defaults.add(key, border);

        }
    }
项目:swingx    文件:IconBorderTest.java   
@Test
public void testSafeBorderBehavingDelegate() {
    JComponent comp = new JButton();
    AbstractBorder delegate = new BevelBorder(BevelBorder.LOWERED);
    SafeBorder border = new SafeBorder(delegate);
    assertNotNull(border.getBorderInsets(comp));
    assertNotNull(border.getBorderInsets(comp, null));
}
项目:seaglass    文件:SeaGlassTableUI.java   
/**
 * Creates a {@link Border} that paints any empty space to the right of the
 * last column header in the given {@link JTable}'s {@link JTableHeader}.
 *
 * @param  table DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 */
private static Border createTableHeaderEmptyColumnPainter(final JTable table) {
    return new AbstractBorder() {
        @Override
        public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
            // if this JTableHeader is parented in a JViewport, then paint
            // the table header background to the right of the last column
            // if neccessary.
            Container viewport = table.getParent();

            if ((viewport instanceof JViewport) && table.getWidth() < viewport.getWidth()) {
                int startX           = table.getWidth();
                int emptyColumnWidth = viewport.getWidth() - table.getWidth();

                TableCellRenderer renderer  = table.getTableHeader().getDefaultRenderer();
                // Rossi: Fix for indexoutofbounds exception: A try catch might be good too?
                Component         component = renderer.getTableCellRendererComponent(table, "", false, false, 0, table.getColumnCount()-1);

                component.setBounds(0, 0, emptyColumnWidth, table.getTableHeader().getHeight());

                ((JComponent) component).setOpaque(true);
                CELL_RENDER_PANE.paintComponent(g, component, null, startX, 0, emptyColumnWidth + 1,
                                                table.getTableHeader().getHeight(), true);
            }
        }
    };
}
项目:infobip-open-jdk-8    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:infobip-open-jdk-8    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:jdk8u-dev-jdk    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:jdk8u-dev-jdk    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:jdk7-jdk    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:jdk7-jdk    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:openjdk-source-code-learn    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:openjdk-source-code-learn    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:OLD-OpenJDK8    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:OLD-OpenJDK8    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:cn1    文件:BasicBordersTest.java   
private void checkInsets(final AbstractBorder border, final Insets testInsets) {
    assertEquals(testInsets, border.getBorderInsets(newJComponent()));
    assertFalse(border.isBorderOpaque());
    Insets insets = new Insets(0, 0, 0, 0);
    border.getBorderInsets(newJComponent(), insets);
    assertEquals(border.getBorderInsets(newJComponent()), insets);
    JComponent button = newJComponent();
    assertFalse(border.getBorderInsets(button) == border.getBorderInsets(button));
}
项目:JAVA_UNIT    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:JAVA_UNIT    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:openjdk-jdk7u-jdk    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:openjdk-jdk7u-jdk    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:freeVM    文件:BasicBordersTest.java   
private void checkInsets(final AbstractBorder border, final Insets testInsets) {
    assertEquals(testInsets, border.getBorderInsets(newJComponent()));
    assertFalse(border.isBorderOpaque());
    Insets insets = new Insets(0, 0, 0, 0);
    border.getBorderInsets(newJComponent(), insets);
    assertEquals(border.getBorderInsets(newJComponent()), insets);
    JComponent button = newJComponent();
    assertFalse(border.getBorderInsets(button) == border.getBorderInsets(button));
}
项目:freeVM    文件:BasicBordersTest.java   
private void checkInsets(final AbstractBorder border, final Insets testInsets) {
    assertEquals(testInsets, border.getBorderInsets(newJComponent()));
    assertFalse(border.isBorderOpaque());
    Insets insets = new Insets(0, 0, 0, 0);
    border.getBorderInsets(newJComponent(), insets);
    assertEquals(border.getBorderInsets(newJComponent()), insets);
    JComponent button = newJComponent();
    assertFalse(border.getBorderInsets(button) == border.getBorderInsets(button));
}
项目:openjdk-icedtea7    文件:Test4856008.java   
public static void main(String[] args) {
    for (Border border : BORDERS) {
        System.out.println(border.getClass());
        test(border, border.getBorderInsets(getComponent(border)));
        if (border instanceof AbstractBorder) {
            test((AbstractBorder) border);
        }
    }
}
项目:openjdk-icedtea7    文件:Test4856008.java   
private static void test(AbstractBorder border) {
    Insets insets = new Insets(0, 0, 0, 0);
    if (insets != border.getBorderInsets(getComponent(border), insets)) {
        throw new Error("both instances are differ for " + border.getClass());
    }
    test(border, insets);
}
项目:consulo    文件:ComboBoxButtonUI.java   
protected void setupBorder(ComboBoxButton comboBoxButton) {
  comboBoxButton.setBorder(new AbstractBorder() {
    @Override
    public Insets getBorderInsets(Component c) {
      final Insets insets = super.getBorderInsets(c);
      //noinspection UseDPIAwareInsets
      return new Insets(insets.top, insets.left + JBUI.scale(2), insets.bottom, insets.right + JBUI.scale(2) + getArrowIcon().getIconWidth());
    }
  });
}
项目:consulo    文件:ModernComboBoxButtonUI.java   
@Override
protected void setupBorder(ComboBoxButton comboBoxButton) {
  comboBoxButton.setBorder(new AbstractBorder() {
    @Override
    public Insets getBorderInsets(Component c) {
      final Insets insets = super.getBorderInsets(c);
      //noinspection UseDPIAwareInsets
      return new Insets(insets.top, insets.left + JBUI.scale(4), insets.bottom, insets.right + JBUI.scale(20));
    }
  });
}