本文整理汇总了Java中javax.swing.ButtonModel.setRollover方法的典型用法代码示例。如果您正苦于以下问题:Java ButtonModel.setRollover方法的具体用法?Java ButtonModel.setRollover怎么用?Java ButtonModel.setRollover使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.ButtonModel
的用法示例。
在下文中一共展示了ButtonModel.setRollover方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureState
import javax.swing.ButtonModel; //导入方法依赖的package包/类
@Override
protected void configureState(CellContext context) {
ButtonModel model = this.rendererComponent.getButtonModel();
if (model != null && context.getComponent() != null) {
Point p = (Point) context.getComponent().getClientProperty(
RolloverProducer.ROLLOVER_KEY);
if (/* hasFocus || */(p != null && (p.x >= 0)
&& (p.x == context.getColumn()) && (p.y == context.getRow()))) {
if (!model.isRollover())
model.setRollover(true);
} else {
if (model.isRollover())
model.setRollover(false);
}
}
}
示例2: mouseEntered
import javax.swing.ButtonModel; //导入方法依赖的package包/类
/**
* Accept a mouse enter event and set the button's "rollover" property to
* <code>true</code>, if the button's "rolloverEnabled" property is
* <code>true</code>. If the button is currently armed and the mouse
* button is not held down, this enter event will also disarm the model.
*
* @param e The mouse enter event to accept
*/
public void mouseEntered(MouseEvent e)
{
if (e.getSource() instanceof AbstractButton)
{
AbstractButton button = (AbstractButton) e.getSource();
ButtonModel model = button.getModel();
if (button.isRolloverEnabled()
&& ! SwingUtilities.isLeftMouseButton(e))
model.setRollover(true);
if (model.isPressed())
model.setArmed(true);
}
}
示例3: mouseExited
import javax.swing.ButtonModel; //导入方法依赖的package包/类
/**
* Accept a mouse exit event and set the button's model's "rollover"
* property to <code>false</code>, if it's "rolloverEnabled" property is
* <code>true</code>. Also disarm the button.
*
* @param e The mouse exit event to accept
*/
public void mouseExited(MouseEvent e)
{
if (e.getSource() instanceof AbstractButton)
{
AbstractButton button = (AbstractButton) e.getSource();
ButtonModel model = button.getModel();
if (button.isRolloverEnabled())
model.setRollover(false);
model.setArmed(false);
}
}
示例4: mouseExited
import javax.swing.ButtonModel; //导入方法依赖的package包/类
public void mouseExited(MouseEvent evt) {
super.mouseExited(evt);
JMenu menu = (JMenu)evt.getSource();
ButtonModel model = menu.getModel();
if (menu.isRolloverEnabled()) {
model.setRollover(false);
menuItem.repaint();
}
}
示例5: mouseExited
import javax.swing.ButtonModel; //导入方法依赖的package包/类
@Override
public void mouseExited(MouseEvent evt) {
super.mouseExited(evt);
JMenuItem menu = (JMenuItem)evt.getSource();
ButtonModel model = menu.getModel();
if (menu.isRolloverEnabled()) {
model.setRollover(false);
menuItem.repaint();
}
}
示例6: dragDropEnd
import javax.swing.ButtonModel; //导入方法依赖的package包/类
@Override
public void dragDropEnd(DragSourceDropEvent dsde) {
//when the drag finishes, then repaint the DnDButton
//so it doesn't look like it has still been pressed down
ButtonModel m = DnDButton.this.getModel();
m.setPressed(false);
m.setRollover(false);
m.setSelected(false);
revalidate();
repaint();
}