當前位置: 首頁>>代碼示例>>Java>>正文


Java ButtonModel.setArmed方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:22,代碼來源:BasicButtonListener.java

示例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();
        }
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:23,代碼來源:BasicButtonListener.java

示例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:    */   }
 
開發者ID:xiwc,項目名稱:confluence.keygen,代碼行數:22,代碼來源:ExtBasicMenuUI.java

示例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);
        }
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:22,代碼來源:BasicButtonListener.java

示例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);
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:23,代碼來源:BasicButtonListener.java

示例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);
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:19,代碼來源:BasicButtonListener.java

示例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);
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:14,代碼來源:BasicRootPaneUI.java

示例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);
        }
    }
}
 
開發者ID:nmldiegues,項目名稱:jvm-stm,代碼行數:22,代碼來源:BasicButtonListener.java


注:本文中的javax.swing.ButtonModel.setArmed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。