本文整理汇总了Java中javax.swing.AbstractButton.isRolloverEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractButton.isRolloverEnabled方法的具体用法?Java AbstractButton.isRolloverEnabled怎么用?Java AbstractButton.isRolloverEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.AbstractButton
的用法示例。
在下文中一共展示了AbstractButton.isRolloverEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawToolbarButton
import javax.swing.AbstractButton; //导入方法依赖的package包/类
/**
* Drasw a button in a toolbar.
*
* @param b
* the button
* @param g
* the graphics instance
*/
public static void drawToolbarButton(Graphics g, AbstractButton b) {
if (!b.isEnabled()) {
return;
}
if (b.getModel().isSelected() && b.isRolloverEnabled() || b.getModel().isPressed() && b.getModel().isArmed()
&& b.isRolloverEnabled()) {
if (b.isContentAreaFilled()) {
drawButton(b, g, createShapeForButton(b));
}
if (b.isBorderPainted()) {
drawButtonBorder(b, g, createBorderShapeForButton(b));
}
} else if (b.getModel().isRollover() && b.isRolloverEnabled()) {
if (b.isBorderPainted()) {
drawButtonBorder(b, g, createBorderShapeForButton(b));
}
}
}
示例2: paint
import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
LAFUtilities.setProperties(g, c);
if (c.isOpaque()) {
ImageLibrary.drawTiledImage("image.background.FreeColButton", g, c, null);
}
super.paint(g, c);
AbstractButton a = (AbstractButton) c;
if (a.isRolloverEnabled()) {
Point p = MouseInfo.getPointerInfo().getLocation();
SwingUtilities.convertPointFromScreen(p, c);
boolean rollover = c.contains(p);
if (rollover) {
paintButtonPressed(g, (AbstractButton) c);
}
}
}
示例3: paintIcon
import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect)
{
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
Icon icon = b.getIcon();
Icon tmpIcon = null;
if( icon == null )
{
return;
}
if( !model.isEnabled() )
{
if( model.isSelected() )
{
tmpIcon = b.getDisabledSelectedIcon();
}
else
{
tmpIcon = b.getDisabledIcon();
}
}
else if( model.isPressed() && model.isArmed() )
{
tmpIcon = b.getPressedIcon();
if( tmpIcon != null )
{
// revert back to 0 offset
clearTextShiftOffset();
}
}
else if( b.isRolloverEnabled() && model.isRollover() )
{
if( model.isSelected() )
{
tmpIcon = b.getRolloverSelectedIcon();
}
else
{
tmpIcon = b.getRolloverIcon();
}
}
else if( model.isSelected() )
{
tmpIcon = b.getSelectedIcon();
}
if( tmpIcon != null )
{
icon = tmpIcon;
}
if( model.isPressed() && model.isArmed() )
{
icon.paintIcon(c, g, iconRect.x + getTextShiftOffset(), iconRect.y + getTextShiftOffset());
}
else
{
icon.paintIcon(c, g, iconRect.x, iconRect.y);
}
}