本文整理匯總了Java中javax.swing.AbstractButton.getWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractButton.getWidth方法的具體用法?Java AbstractButton.getWidth怎麽用?Java AbstractButton.getWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.AbstractButton
的用法示例。
在下文中一共展示了AbstractButton.getWidth方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: paintFocus
import javax.swing.AbstractButton; //導入方法依賴的package包/類
@Override
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect){
int width = b.getWidth();
int height = b.getHeight();
g.setColor(getFocusColor());
BasicGraphicsUtils.drawDashedRect(g, dashedRectGapX, dashedRectGapY,
width - dashedRectGapWidth, height - dashedRectGapHeight);
}
示例2: createShapeForButton
import javax.swing.AbstractButton; //導入方法依賴的package包/類
/**
* Creates the default {@link Shape} for the given button.
*
* @param b
* the button to create the shape for
* @return the shape instance
*/
public static Shape createShapeForButton(AbstractButton b) {
int w = b.getWidth();
int h = b.getHeight();
return new RoundRectangle2D.Double(1, 1, w - 2, h - 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
}
示例3: createBorderShapeForButton
import javax.swing.AbstractButton; //導入方法依賴的package包/類
/**
* Creates the border {@link Shape} for the given button.
*
* @param b
* the button to create the border shape for
* @return the border shape instance
*/
public static Shape createBorderShapeForButton(AbstractButton b) {
int w = b.getWidth();
int h = b.getHeight();
return new RoundRectangle2D.Double(0, 0, w - 1, h - 1, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
}