本文整理匯總了Java中javax.swing.plaf.basic.BasicGraphicsUtils.getPreferredButtonSize方法的典型用法代碼示例。如果您正苦於以下問題:Java BasicGraphicsUtils.getPreferredButtonSize方法的具體用法?Java BasicGraphicsUtils.getPreferredButtonSize怎麽用?Java BasicGraphicsUtils.getPreferredButtonSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.plaf.basic.BasicGraphicsUtils
的用法示例。
在下文中一共展示了BasicGraphicsUtils.getPreferredButtonSize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPreferredSize
import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
@Override
public Dimension getPreferredSize(JComponent c) {
AbstractButton b = (AbstractButton) c;
Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b, b
.getIconTextGap());
/* Ensure that the width of the button is odd,
* to improve the painting of the dashed focus line
*/
if (d != null && b.isFocusPainted()) {
if (d.width % 2 == 0) {
d.width += 1;
}
}
return d;
}
示例2: getPreferredSize
import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
public Dimension getPreferredSize() {
if (getComponentCount() == 1 && getComponent(0) instanceof CellRendererPane) {
return BasicGraphicsUtils.getPreferredButtonSize(fgStamp, getIconTextGap());
}
return super.getPreferredSize();
}
示例3: getPreferredSize
import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
public Dimension getPreferredSize(JComponent c) {
AbstractButton b = (AbstractButton) c;
Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b, b.getIconTextGap());
Insets margin = b.getMargin();
d.setSize(d.getWidth() + margin.left + margin.right, d.getHeight() + margin.top + margin.bottom);
return d;
}