本文整理汇总了Java中javax.swing.ButtonModel.setArmed方法的典型用法代码示例。如果您正苦于以下问题:Java ButtonModel.setArmed方法的具体用法?Java ButtonModel.setArmed怎么用?Java ButtonModel.setArmed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.ButtonModel
的用法示例。
在下文中一共展示了ButtonModel.setArmed方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import javax.swing.ButtonModel; //导入方法依赖的package包/类
/**
* Performs the action.
*/
public void actionPerformed(ActionEvent event)
{
Object cmd = getValue("__command__");
AbstractButton b = (AbstractButton) event.getSource();
ButtonModel m = b.getModel();
if (PRESSED.equals(cmd))
{
m.setArmed(true);
m.setPressed(true);
if (! b.isFocusOwner())
b.requestFocus();
}
else if (RELEASED.equals(cmd))
{
m.setPressed(false);
m.setArmed(false);
}
}
示例2: mousePressed
import javax.swing.ButtonModel; //导入方法依赖的package包/类
/**
* Accept a mouse press event and arm the button.
*
* @param e The mouse press event to accept
*/
public void mousePressed(MouseEvent e)
{
if (e.getSource() instanceof AbstractButton)
{
AbstractButton button = (AbstractButton) e.getSource();
ButtonModel model = button.getModel();
if (SwingUtilities.isLeftMouseButton(e))
{
// It is important that these transitions happen in this order.
model.setArmed(true);
model.setPressed(true);
if (! button.isFocusOwner() && button.isRequestFocusEnabled())
button.requestFocus();
}
}
}
示例3: ensureSubMenuInstalled
import javax.swing.ButtonModel; //导入方法依赖的package包/类
private void ensureSubMenuInstalled()
/* 92: */ {
/* 93:156 */ if (this.propertyPrefix.equals("MenuItem")) {
/* 94:157 */ return;
/* 95: */ }
/* 96:159 */ ButtonModel model = this.menuItem.getModel();
/* 97: */
/* 98: */
/* 99: */
/* 100:163 */ boolean oldArmed = model.isArmed();
/* 101:164 */ boolean oldSelected = model.isSelected();
/* 102: */
/* 103:166 */ uninstallRolloverListener();
/* 104:167 */ uninstallDefaults();
/* 105:168 */ this.propertyPrefix = "MenuItem";
/* 106:169 */ installDefaults();
/* 107: */
/* 108: */
/* 109:172 */ model.setArmed(oldArmed);
/* 110:173 */ model.setSelected(oldSelected);
/* 111: */ }
示例4: mouseReleased
import javax.swing.ButtonModel; //导入方法依赖的package包/类
/**
* Accept a mouse release event and set the button's
* "pressed" property to <code>true</code>, if the model
* is armed. If the model is not armed, ignore the event.
*
* @param e The mouse release event to accept
*/
public void mouseReleased(MouseEvent e)
{
if (e.getSource() instanceof AbstractButton)
{
AbstractButton button = (AbstractButton) e.getSource();
ButtonModel model = button.getModel();
if (e.getButton() == MouseEvent.BUTTON1)
{
// It is important that these transitions happen in this order.
model.setPressed(false);
model.setArmed(false);
}
}
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: actionPerformed
import javax.swing.ButtonModel; //导入方法依赖的package包/类
/**
* Performes the action.
*/
public void actionPerformed(ActionEvent ev)
{
JButton b = rootPane.getDefaultButton();
if (b != null)
{
ButtonModel m = b.getModel();
m.setArmed(true);
m.setPressed(true);
}
}
示例8: mouseReleased
import javax.swing.ButtonModel; //导入方法依赖的package包/类
/**
* Accept a mouse release event and set the button's
* "pressed" property to <code>true</code>, if the model
* is armed. If the model is not armed, ignore the event.
*
* @param e The mouse release event to accept
*/
public void mouseReleased(MouseEvent e)
{
if (e.getSource() instanceof AbstractButton)
{
AbstractButton button = (AbstractButton) e.getSource();
ButtonModel model = button.getModel();
if (e.getButton() == MouseEvent.BUTTON1)
{
// It is important that these transitions happen in this order.
model.setPressed(false);
model.setArmed(false);
}
}
}