本文整理匯總了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();
}