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


Java JComponent.getInsets方法代碼示例

本文整理匯總了Java中javax.swing.JComponent.getInsets方法的典型用法代碼示例。如果您正苦於以下問題:Java JComponent.getInsets方法的具體用法?Java JComponent.getInsets怎麽用?Java JComponent.getInsets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JComponent的用法示例。


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

示例1: getPreferredSize

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public Dimension getPreferredSize(JComponent c) {
    FontMetrics fm = getTxtFontMetrics();
    int height = fm == null ?
            19 : fm.getAscent() + 2 * fm.getDescent() + 5;
    Insets insets = c.getInsets();
    prefSize.height = height + insets.bottom + insets.top;
    return prefSize;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:NimbusViewTabDisplayerUI.java

示例2: getPreferredSize

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public Dimension getPreferredSize(JComponent c) {
    FontMetrics fm = getTxtFontMetrics();
    int height = fm == null ?
            21 : fm.getAscent() + 2 * fm.getDescent() + 3;
    height += 1; //align with editor tabs
    Insets insets = c.getInsets();
    prefSize.height = height + insets.bottom + insets.top;
    return prefSize;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:AquaViewTabDisplayerUI.java

示例3: getPreferredSize

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public Dimension getPreferredSize(JComponent c) {
    FontMetrics fm = getTxtFontMetrics();
    int height = fm == null ?
            19 : fm.getAscent() + 2 * fm.getDescent() + 2;
    Insets insets = c.getInsets();
    prefSize.height = height + insets.bottom + insets.top;
    return prefSize;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:WinClassicViewTabDisplayerUI.java

示例4: getPreferredSize

import javax.swing.JComponent; //導入方法依賴的package包/類
public Dimension getPreferredSize(JComponent c) {
    FontMetrics fm = getTxtFontMetrics();
    int height = fm == null ?
            19 : fm.getAscent() + 2 * fm.getDescent() + 5;
    Insets insets = c.getInsets();
    prefSize.height = height + insets.bottom + insets.top;
    return prefSize;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:GtkViewTabDisplayerUI.java

示例5: getPreferredSize

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public Dimension getPreferredSize(JComponent c) {
    FontMetrics fm = getTxtFontMetrics();
    int height = fm == null ?
            21 : fm.getAscent() + 2 * fm.getDescent() + 4;
    Insets insets = c.getInsets();
    prefSize.height = height + insets.bottom + insets.top;
    return prefSize;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:MetalViewTabDisplayerUI.java

示例6: getPreferredSize

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public Dimension getPreferredSize(JComponent c) {
    FontMetrics fm = getTxtFontMetrics();
    int height = fm == null ?
            17 : fm.getAscent() + 2 * fm.getDescent() + 3;
    Insets insets = c.getInsets();
    prefSize.height = height + insets.bottom + insets.top;
    return prefSize;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:AbstractWinViewTabDisplayerUI.java

示例7: getButtonChildIndent

import javax.swing.JComponent; //導入方法依賴的package包/類
/**
 * Returns the amount to indent the specified component if it's
 * a JCheckBox or JRadioButton.  If the component is not a JCheckBox or
 * JRadioButton, 0 will be returned.
 */
int getButtonChildIndent(JComponent c, int position) {
    if ((c instanceof JRadioButton) || (c instanceof JCheckBox)) {
        AbstractButton button = (AbstractButton)c;
        Insets insets = c.getInsets();
        Icon icon = getIcon(button);
        int gap = button.getIconTextGap();
        if (isLeftAligned(button, position)) {
            return insets.left + icon.getIconWidth() + gap;
        } else if (isRightAligned(button, position)) {
            return insets.right + icon.getIconWidth() + gap;
        }
    }
    return 0;
}
 
開發者ID:fesch,項目名稱:Moenagade,代碼行數:20,代碼來源:LayoutStyle.java

示例8: getPreferredSize

import javax.swing.JComponent; //導入方法依賴的package包/類
public Dimension getPreferredSize(JComponent c) {
    Insets insets = c.getInsets();
    int dx = insets.left + insets.right;
    int dy = insets.top + insets.bottom;
    return (scrollbar.getOrientation() == JScrollBar.VERTICAL)
        ? new Dimension(dx + 11, dy + 33)
        : new Dimension(dx + 33, dy + 11);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:9,代碼來源:MotifScrollBarUI.java

示例9: test

import javax.swing.JComponent; //導入方法依賴的package包/類
void test(final JComponent component) {
    final Insets p = component.getInsets();
    p.top += 3;
    if (p.equals(component.getInsets())) {
        throw new RuntimeException("Insets altered by altering Insets!");
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:InsetsEncapsulation.java

示例10: paint

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public void paint(Graphics g, JComponent c) {
	AbstractButton b = (AbstractButton) c;

	Dimension size = b.getSize();
	FontMetrics fm = g.getFontMetrics();

	Insets i = c.getInsets();

	Rectangle viewRect = new Rectangle(size);

	viewRect.x += i.left;
	viewRect.y += i.top;
	viewRect.width -= i.right + viewRect.x;
	viewRect.height -= i.bottom + viewRect.y;

	Rectangle iconRect = new Rectangle();
	Rectangle textRect = new Rectangle();

	Font f = c.getFont();
	g.setFont(f);

	String text = SwingUtilities.layoutCompoundLabel(c, fm, b.getText(), b.getIcon(), b.getVerticalAlignment(),
			b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, iconRect,
			textRect, b.getText() == null ? 0 : b.getIconTextGap());

	g.setColor(b.getBackground());

	if (b.isContentAreaFilled()) {
		if (RapidLookTools.isToolbarButton(b)) {
			RapidLookTools.drawToolbarButton(g, b);
		} else {
			RapidLookTools.drawButton(b, g, RapidLookTools.createShapeForButton(b));
		}
	}

	if (b.getIcon() != null) {
		paintIcon(g, b, iconRect);
	}

	if (text != null && !text.equals("")) {
		View v = (View) c.getClientProperty(BasicHTML.propertyKey);
		if (v != null) {
			v.paint(g, textRect);
		} else {
			paintText(g, b, textRect, text);
		}
	}

	if (b.isFocusPainted() && b.hasFocus()) {
		paintFocus(g, b, viewRect, textRect, iconRect);
	}

	if (!RapidLookTools.isToolbarButton(b)) {
		if (b.isBorderPainted()) {
			RapidLookTools.drawButtonBorder(b, g, RapidLookTools.createBorderShapeForButton(b));
		}
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:60,代碼來源:ToggleButtonUI.java


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