当前位置: 首页>>代码示例>>Java>>正文


Java AbstractButton.isEnabled方法代码示例

本文整理汇总了Java中javax.swing.AbstractButton.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractButton.isEnabled方法的具体用法?Java AbstractButton.isEnabled怎么用?Java AbstractButton.isEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.AbstractButton的用法示例。


在下文中一共展示了AbstractButton.isEnabled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:RapidLookTools.java

示例2: drawButtonBorder

import javax.swing.AbstractButton; //导入方法依赖的package包/类
/**
 * Draws the given button border with the specified shape.
 *
 * @param b
 * @param g
 * @param shape
 */
public static void drawButtonBorder(AbstractButton b, Graphics g, Shape shape) {
	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	if (b.isEnabled()) {
		if (b.hasFocus()) {
			g2.setColor(Colors.BUTTON_BORDER_FOCUS);
		} else {
			g2.setColor(Colors.BUTTON_BORDER);
		}
	} else {
		g2.setColor(Colors.BUTTON_BORDER_DISABLED);
	}

	g2.draw(shape);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:24,代码来源:RapidLookTools.java

示例3: mouseEntered

import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
public void mouseEntered(MouseEvent evt) {
    Object src = evt.getSource();

    if (src instanceof AbstractButton) {
        AbstractButton button = (AbstractButton) evt.getSource();
        if (button.isEnabled()) {
            button.setContentAreaFilled(true);
            button.setBorderPainted(true);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:SearchButton.java

示例4: refresh

import javax.swing.AbstractButton; //导入方法依赖的package包/类
private void refresh(final AbstractButton b) {
    b.setBackground(UIUtils.getProfilerResultsBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:TransparentToolBar.java

示例5: mouseEntered

import javax.swing.AbstractButton; //导入方法依赖的package包/类
public @Override void mouseEntered(MouseEvent evt) {
    Object src = evt.getSource();
    
    if (src instanceof AbstractButton) {
        AbstractButton button = (AbstractButton)evt.getSource();
        if (button.isEnabled()) {
            button.setContentAreaFilled(true);
            button.setBorderPainted(true);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:NbEditorToolBar.java

示例6: isEnabledAndSelected

import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
protected boolean isEnabledAndSelected(AbstractButton button)
{
	return button.isEnabled() && button.isSelected();
}
 
开发者ID:equella,项目名称:Equella,代码行数:6,代码来源:RadioButtonChoiceList.java

示例7: paint

import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
public synchronized void paint(Graphics g, JComponent c)
{
	AbstractButton b = (AbstractButton) c;
	ButtonModel model = b.getModel();
	Dimension d = b.getSize();

	g.setFont(c.getFont());
	FontMetrics fm = g.getFontMetrics();

	Icon icon = mIconUnchecked;
	if( model.isPressed() && model.isSelected() )
	{
		icon = mIconPressedChecked;
	}
	else if( model.isPressed() && !model.isSelected() )
	{
		icon = mIconPressedUnchecked;
	}
	else if( !model.isPressed() && model.isSelected() )
	{
		icon = mIconChecked;
	}

	int x = 0;
	int y = (d.height - icon.getIconHeight()) / 2;
	icon.paintIcon(c, g, x, y);

	if( b.isEnabled() )
	{
		g.setColor(mTextNormal);
	}
	else
	{
		g.setColor(mTextDisabled);
	}

	String caption = b.getText();
	x = icon.getIconWidth() + mTextIconGap;
	y = (d.height + fm.getAscent()) / 2;
	g.drawString(caption, x, y);
}
 
开发者ID:equella,项目名称:Equella,代码行数:43,代码来源:FlatterCheckBoxUI.java


注:本文中的javax.swing.AbstractButton.isEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。