javax.swing.JToggleButton.addItemListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中javax.swing.JToggleButton.addItemListener()方法的一些代码示例,展示了JToggleButton.addItemListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JToggleButton.addItemListener()方法的具体详情如下:
包路径:javax.swing.JToggleButton
类名称:JToggleButton
方法名:addItemListener

JToggleButton.addItemListener介绍

暂无

代码示例

代码示例来源:origin: 4thline/cling

toggleButton.setPreferredSize(new Dimension(128, 128));
toggleButton.addItemListener(new ItemListener() {
  public void itemStateChanged(ItemEvent itemEvent) {
    int state = itemEvent.getStateChange();

代码示例来源:origin: 4thline/cling

muteButton.setPreferredSize(new Dimension(60, 50));
muteButton.addItemListener(new ItemListener() {
  public void itemStateChanged(ItemEvent itemEvent) {
    int state = itemEvent.getStateChange();

代码示例来源:origin: magefree/mage

private AbstractButton createSwitchPanelsButton() {
  final JToggleButton switchPanelsButton = new JToggleButton("Switch panels");
  switchPanelsButton.addItemListener(e -> {
    if (e.getStateChange() == ItemEvent.SELECTED) {
      createAndShowSwitchPanelsMenu((JComponent) e.getSource(), switchPanelsButton);
    }
  });
  switchPanelsButton.setFocusable(false);
  switchPanelsButton.setHorizontalTextPosition(SwingConstants.LEADING);
  return switchPanelsButton;
}

代码示例来源:origin: com.google.code.validationframework/validationframework-swing

public BaseJToggleButtonModelChangedTrigger(C source) {
  super();
  this.source = source;
  source.addItemListener(sourceAdapter);
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

/**
 * Called by SwingViewerBuilder, so that SwingController can setup event handling
 */
public void setHighlightAnnotationToolButton(JToggleButton btn) {
  highlightAnnotationToolButton = btn;
  btn.addItemListener(this);
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

/**
 * Called by SwingViewerBuilder, so that SwingController can setup event handling
 */
public void setTextAnnotationToolButton(JToggleButton btn) {
  textAnnotationToolButton = btn;
  btn.addItemListener(this);
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

/**
 * Called by SwingViewerBuilder, so that SwingController can setup event handling
 */
public void setPanToolButton(JToggleButton btn) {
  panToolButton = btn;
  btn.addItemListener(this);
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

/**
 * Called by SwingViewerBuilder, so that SwingController can setup event handling
 */
public void setZoomInToolButton(JToggleButton btn) {
  zoomInToolButton = btn;
  btn.addItemListener(this);
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

/**
 * Called by SwingViewerBuilder, so that SwingController can setup event handling
 */
public void setTextSelectToolButton(JToggleButton btn) {
  textSelectToolButton = btn;
  btn.addItemListener(this);
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

/**
 * Called by SwingViewerBuilder, so that SwingController can setup event handling
 */
public void setUnderlineAnnotationToolButton(JToggleButton btn) {
  underlineAnnotationToolButton = btn;
  btn.addItemListener(this);
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

/**
 * Called by SwingViewerBuilder, so that SwingController can setup event handling
 */
public void setFreeTextAnnotationToolButton(JToggleButton btn) {
  freeTextAnnotationToolButton = btn;
  btn.addItemListener(this);
}

代码示例来源:origin: jrtom/jung

public JToggleButton getFillButton() {
 JToggleButton fillButton = new JToggleButton("Fill");
 fillButton.addItemListener(
   new ItemListener() {
    public void itemStateChanged(ItemEvent e) {
     annotatingPlugin.setFill(e.getStateChange() == ItemEvent.SELECTED);
    }
   });
 return fillButton;
}

代码示例来源:origin: net.sf.jung/jung-visualization

public JToggleButton getFillButton() {
  JToggleButton fillButton = new JToggleButton("Fill");
  fillButton.addItemListener(new ItemListener() {
    public void itemStateChanged(ItemEvent e) {
      annotatingPlugin.setFill(e.getStateChange() == ItemEvent.SELECTED);
      
    }});
  return fillButton;
}

代码示例来源:origin: stackoverflow.com

JToggleButton toggleButton = new JToggleButton("Click Me");
ItemListener itemListener = new ItemListener() {
  public void itemStateChanged(ItemEvent itemEvent) {
    int state = itemEvent.getStateChange();
    if (state == ItemEvent.SELECTED) {
      System.out.println("Selected"); // show your message here
    } else {
      System.out.println("Deselected"); // remove your message
    }
  }
};
toggleButton.addItemListener(itemListener);

代码示例来源:origin: org.fudaa.framework.ebli/ebli-common

public BSelecteurCheckBox(final String _property, final JToggleButton _cb) {
 super(_property);
 cb_ = _cb;
 cb_.addItemListener(this);
 if (_property == PROP_VISIBLE) {
  setTitle(EbliLib.getS("Visible"));
 }
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets

protected void createButton() {
  $objectMap.put("button", button = new JToggleButton());
  
  button.setName("button");
  button.setFocusPainted(false);
  button.setFocusable(true);
  button.addItemListener(JAXXUtil.getEventListener(ItemListener.class, "itemStateChanged", this, "doItemStateChanged__on__button"));
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets-i18n

protected void createButton() {
  $objectMap.put("button", button = new JToggleButton());
  
  button.setName("button");
  button.setFocusPainted(false);
  button.setFocusable(true);
  button.addItemListener(JAXXUtil.getEventListener(ItemListener.class, "itemStateChanged", this, "doItemStateChanged__on__button"));
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing-widget

protected void createButton() {
  button = new javax.swing.JToggleButton();
  $objectMap.put("button", button);
  button.setName("button");
  button.setFocusPainted(false);
  button.setFocusable(true);
  button.addItemListener((java.awt.event.ItemListener) jaxx.runtime.Util.getEventListener(java.awt.event.ItemListener.class, "itemStateChanged", content, "doItemStateChanged__on__button"));
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-midp

public void setBitmask(int bitmask) {
  for (JToggleButton button : guiItems) {
    button.removeItemListener(this);
  }
  constraints.setBitmask(bitmask);
  setGui();
  for (JToggleButton button : guiItems) {
    button.addItemListener(this);
  }
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing-widget

protected void createButton() {
  button = new javax.swing.JToggleButton();
  $objectMap.put("button", button);
  button.setName("button");
  button.setBorderPainted(false);
  button.setFocusPainted(false);
  button.setFocusable(true);
  button.setRolloverEnabled(false);
  button.setToolTipText(_("columnselector.action.tip"));
  button.addItemListener((java.awt.event.ItemListener) jaxx.runtime.Util.getEventListener(java.awt.event.ItemListener.class, "itemStateChanged", $JPanel0, "doItemStateChanged__on__button"));
}

相关文章

JToggleButton类方法