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


Java ButtonModel.setPressed方法代码示例

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


在下文中一共展示了ButtonModel.setPressed方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例4: 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

示例5: 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

示例6: setPressed

import javax.swing.ButtonModel; //导入方法依赖的package包/类
@Override
public void setPressed(final boolean pressed)
{
	final AbstractButton buttonSwing = getComponent();
	final ButtonModel model = buttonSwing.getModel();
	model.setPressed(pressed);
	buttonSwing.updateUI();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:9,代码来源:SwingTerminalButtonWrapper.java

示例7: 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();
}
 
开发者ID:chhh,项目名称:batmass,代码行数:12,代码来源:DnDButton.java


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