當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractBorder類代碼示例

本文整理匯總了Java中javax.swing.border.AbstractBorder的典型用法代碼示例。如果您正苦於以下問題:Java AbstractBorder類的具體用法?Java AbstractBorder怎麽用?Java AbstractBorder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AbstractBorder類屬於javax.swing.border包,在下文中一共展示了AbstractBorder類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createTableHeaderEmptyColumnPainter

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
/**
 * 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);
            }
        }
    };
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:20,代碼來源:TableHeaderUtils.java

示例2: getInsets

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
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;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:19,代碼來源:JComponent.java

示例3: createTableHeaderEmptyColumnPainter

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
/**
 * 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);
            }
        }
    };
}
 
開發者ID:mediathekview,項目名稱:MediathekView,代碼行數:21,代碼來源:TableHeaderUtils.java

示例4: main

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
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);
        }
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:10,代碼來源:Test4856008.java

示例5: test

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
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);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:Test4856008.java

示例6: replaceBorder

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
/**
     * @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);
            
        }
    }
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:20,代碼來源:TableAddon.java

示例7: testSafeBorderBehavingDelegate

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
@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));
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:9,代碼來源:IconBorderTest.java

示例8: createTableHeaderEmptyColumnPainter

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
/**
 * 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);
            }
        }
    };
}
 
開發者ID:khuxtable,項目名稱:seaglass,代碼行數:35,代碼來源:SeaGlassTableUI.java

示例9: checkInsets

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
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));
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:10,代碼來源:BasicBordersTest.java

示例10: setupBorder

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
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());
    }
  });
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:11,代碼來源:ComboBoxButtonUI.java

示例11: setupBorder

import javax.swing.border.AbstractBorder; //導入依賴的package包/類
@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));
    }
  });
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:12,代碼來源:ModernComboBoxButtonUI.java


注:本文中的javax.swing.border.AbstractBorder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。