javax.swing.JCheckBox.setActionCommand()方法的使用及代码示例

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

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

JCheckBox.setActionCommand介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor

private void fillBoxes() {
  boxes = new ArrayList<>();
  boxes.add(onOffCheckBox);
  boxes.add(keepMarksCheckBox);
  onOffCheckBox.setActionCommand(MarkOccurencesSettings.ON_OFF);
  keepMarksCheckBox.setActionCommand(MarkOccurencesSettings.KEEP_MARKS);
}

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

showCardName.setText("Show card name on card panel");
showCardName.setToolTipText("Write the card's name on the card to make the card name more recognizable.");
showCardName.setActionCommand("");
showCardName.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
showCardName.addActionListener(new java.awt.event.ActionListener() {
cbStopAttack.setText("Stop on declare attackers step if you skip steps (F4/F5/F7) and attackers are available");
cbStopAttack.setToolTipText("If you use F4, F5 or F7 to skip steps, you stop on declare attackers step if attackers are available. If this option is not activated, you also skip the declare attackers step with this actions. F9 does always skip the declare attackers step.");
cbStopAttack.setActionCommand("");
cbStopAttack.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
cbStopBlock.setActionCommand("");
cbStopBlock.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
cbStopOnAllMain.setActionCommand("");
cbStopOnAllMain.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
cbStopOnAllEnd.setActionCommand("");
cbStopOnAllEnd.setPreferredSize(new java.awt.Dimension(300, 25));
cbStopOnAllEnd.addActionListener(new java.awt.event.ActionListener() {
cbPassPriorityCast.setActionCommand("");
cbPassPriorityCast.setPreferredSize(new java.awt.Dimension(300, 25));
cbPassPriorityCast.addActionListener(new java.awt.event.ActionListener() {
cbPassPriorityActivation.setActionCommand("");

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

private void createAxeVisible() {
 cbAxeVisible_= new JCheckBox();
 cbAxeVisible_.setActionCommand("AXEVISIBLE");
 if (axes_.length > 0) {
  cbAxeVisible_.setSelected(((Axe)axes_[0]).visible_);
 }
 cbAxeVisible_.addActionListener(this);
}
private void createAxeTitre() {

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

private void createCourbeMarqueurs() {
 cbCourbeMarqueurs_= new JCheckBox();
 cbCourbeMarqueurs_.setActionCommand("COURBEMARQUEURS");
 if (courbes_.length > 0) {
  cbCourbeMarqueurs_.setSelected(((CourbeDefault)courbes_[0]).marqueurs_);
 }
 cbCourbeMarqueurs_.addActionListener(this);
}
private void createCourbeVisible() {

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

private void createAxeGrille() {
 cbAxeGrille_= new JCheckBox();
 cbAxeGrille_.setActionCommand("AXEGRILLE");
 if (axes_.length > 0) {
  cbAxeGrille_.setSelected(((Axe)axes_[0]).grille_);
 }
 cbAxeGrille_.addActionListener(this);
}
private void createAxeVisible() {

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

private void createCourbeVisible() {
 cbCourbeVisible_= new JCheckBox();
 cbCourbeVisible_.setActionCommand("COURBEVISIBLE");
 if (courbes_.length > 0) {
  cbCourbeVisible_.setSelected(((CourbeDefault)courbes_[0]).visible_);
 }
 cbCourbeVisible_.addActionListener(this);
}
private void createCourbeTitre() {

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

private void createCbLegende() {
 cbGrapheLegende_= new JCheckBox();
 cbGrapheLegende_.setActionCommand("GRAPHELEGENDE");
 cbGrapheLegende_.setSelected(graphe_.legende_);
 cbGrapheLegende_.addActionListener(this);
}
private void createSousTitre() {

代码示例来源:origin: com.fifesoft.rtext/fife.common

private JCheckBox createCheckBox(ResourceBundle msg, String root) {
  JCheckBox cb = new JCheckBox(msg.getString(root + "Label"));
  cb.setMnemonic((int)msg.getString(root + "Mnemonic").charAt(0));
  cb.setActionCommand(root);
  cb.addActionListener(this);
  return cb;
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components

/**
 * Create a panel containing the title label for the table.
 *
 * @return a panel containing the title label
 */
private Component makeLabelPanel() {
  JPanel labelPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
  ButtonGroup bg = new ButtonGroup();
  bg.add(systemButton);
  bg.add(jmeterButton);
  jmeterButton.setSelected(true);
  systemButton.setActionCommand(SYSTEM);
  jmeterButton.setActionCommand(JMETER);
  systemButton.addActionListener(this);
  jmeterButton.addActionListener(this);
  labelPanel.add(systemButton);
  labelPanel.add(jmeterButton);
  labelPanel.add(tableLabel);
  return labelPanel;
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http

private JPanel createNotifyListenersPanel() {
  JPanel panel = new JPanel();
  panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils
      .getResString("notify_child_listeners_fr"))); // $NON-NLS-1$
  
  notifyChildSamplerListenerOfFilteredSamplersCB = new JCheckBox(JMeterUtils.getResString("notify_child_listeners_fr")); // $NON-NLS-1$
  notifyChildSamplerListenerOfFilteredSamplersCB.setSelected(false);
  notifyChildSamplerListenerOfFilteredSamplersCB.addActionListener(this);
  notifyChildSamplerListenerOfFilteredSamplersCB.setActionCommand(ENABLE_RESTART);
  panel.add(notifyChildSamplerListenerOfFilteredSamplersCB);
  return panel;
}

代码示例来源:origin: com.fifesoft.rtext/fife.common

/**
 * Creates a checkbox for use in this dialog.
 *
 * @param msg The resouce bundle for localizations.
 * @param keyRoot The root of the keys in the resource bundle to use
 *        when localizing.
 * @return The checkbox.
 */
private JCheckBox createCheckBox(ResourceBundle msg, String keyRoot) {
  JCheckBox cb = new JCheckBox(msg.getString(keyRoot));
  cb.setMnemonic((int)msg.getString(keyRoot+"Mnemonic").charAt(0));
  cb.setActionCommand(keyRoot);
  cb.addActionListener(this);
  return cb;
}

代码示例来源:origin: jfree/jfreechart

protected JPanel createTickUnitPanel() {
  JPanel tickUnitPanel = new JPanel(new LCBLayout(3));
  tickUnitPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
  tickUnitPanel.add(new JPanel());
  this.autoTickUnitSelectionCheckBox = new JCheckBox(
      localizationResources.getString("Auto-TickUnit_Selection"),
      this.autoTickUnitSelection);
  this.autoTickUnitSelectionCheckBox.setActionCommand("AutoTickOnOff");
  this.autoTickUnitSelectionCheckBox.addActionListener(this);
  tickUnitPanel.add(this.autoTickUnitSelectionCheckBox);
  tickUnitPanel.add(new JPanel());
  return tickUnitPanel;
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

/**
 * creates a new checkbox.
 * 
 * @param name
 *            the name of the box.
 * @param sel
 *            the selection state.
 * @return a new checkbox.
 */
private JCheckBox createCheckBox(String name, boolean sel) {
  JCheckBox b = new JCheckBox(name, sel);
  b.setActionCommand(name);
  b.addActionListener(this);
  b.setBackground(Color.white);
  return b;
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

private JPanel createControlPanel() {
  onTop = new JCheckBox("Top Position in Layer");
  onTop.setSelected(true);
  onTop.setActionCommand(ON_TOP_COMMAND);
  onTop.addActionListener(this);
  layerList = new JComboBox(layerStrings);
  layerList.setSelectedIndex(2);    //cyan layer
  layerList.setActionCommand(LAYER_COMMAND);
  layerList.addActionListener(this);
  JPanel controls = new JPanel();
  controls.add(layerList);
  controls.add(onTop);
  controls.setBorder(BorderFactory.createTitledBorder(
               "Choose Duke's Layer and Position"));
  return controls;
}

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

String[] ccys = {"USD", "EUR", "CHF", "JPY"};

public void initUI(){
 ...

 ButtonGroup grp = new ButtonGroup();

 for(String ccy : ccys){
 JCheckBox cb = new JCheckBox(ccy);
 cb.setActionCommand(ccy);
 cb.addActionListener(this);
 grp.add(cb);

 ...(add CheckBox to ui)
 }
}

private double getRate(String ccy){
 ...(retrieve the current conversion rate, f.ex from a map)
}

public void actionPerformed(ActionEvent evt){
 Double rate = getRate(evt.getActionCommand());
 ...(calculation, display)
}

代码示例来源:origin: MegaMek/megamek

public CheckCritPanel(int crits, int current) {
  setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
  for (int i = 0; i < crits; i++) {
    JCheckBox check = new JCheckBox("");
    check.setActionCommand(Integer.toString(i));
    check.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        checkBoxes(evt);
      }
    });
    checks.add(check);
    add(check);
  }
  if (current > 0) {
    for (int i = 0; i < current; i++) {
      checks.get(i).setSelected(true);
    }
  }
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

/**
 * Create a GUI panel containing the components related to the number of
 * loops which should be executed.
 *
 * @return a GUI panel containing the loop count components
 */
private JPanel createLoopCountPanel() {
  JPanel loopPanel = new JPanel(new BorderLayout(5, 0));
  // LOOP LABEL
  JLabel loopsLabel = new JLabel(JMeterUtils.getResString("iterator_num")); // $NON-NLS-1$
  loopPanel.add(loopsLabel, BorderLayout.WEST);
  JPanel loopSubPanel = new JPanel(new BorderLayout(5, 0));
  // TEXT FIELD
  loops = new JTextField("1", 5); // $NON-NLS-1$
  loops.setName(LOOPS);
  loopsLabel.setLabelFor(loops);
  loopSubPanel.add(loops, BorderLayout.CENTER);
  // FOREVER CHECKBOX
  infinite = new JCheckBox(JMeterUtils.getResString("infinite")); // $NON-NLS-1$
  infinite.setActionCommand(INFINITE);
  infinite.addActionListener(this);
  loopSubPanel.add(infinite, BorderLayout.WEST);
  loopPanel.add(loopSubPanel, BorderLayout.CENTER);
  loopPanel.add(Box.createHorizontalStrut(loopsLabel.getPreferredSize().width + loops.getPreferredSize().width
      + infinite.getPreferredSize().width), BorderLayout.NORTH);
  return loopPanel;
}

代码示例来源:origin: jfree/jfreechart

@Override
protected JPanel createTickUnitPanel()
{
  JPanel tickUnitPanel = new JPanel(new LCBLayout(3));
  tickUnitPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
  tickUnitPanel.add(new JPanel());
  JCheckBox autoTickUnitSelectionCheckBox = new JCheckBox(
      localizationResources.getString("Auto-TickUnit_Selection"),
      isAutoTickUnitSelection());
  autoTickUnitSelectionCheckBox.setActionCommand("AutoTickOnOff");
  autoTickUnitSelectionCheckBox.addActionListener(this);
  setAutoTickUnitSelectionCheckBox(autoTickUnitSelectionCheckBox);
  tickUnitPanel.add(getAutoTickUnitSelectionCheckBox());
  tickUnitPanel.add(new JPanel());
  tickUnitPanel.add(new JLabel(localizationResources.getString(
      "Manual_TickUnit_value")));
  this.manualTickUnit = new JTextField(Double.toString(
      this.manualTickUnitValue));
  this.manualTickUnit.setEnabled(!isAutoTickUnitSelection());
  this.manualTickUnit.setActionCommand("TickUnitValue");
  this.manualTickUnit.addActionListener(this);
  this.manualTickUnit.addFocusListener(this);
  tickUnitPanel.add(this.manualTickUnit);
  tickUnitPanel.add(new JPanel());
  return tickUnitPanel;
}

代码示例来源:origin: chungkwong/MathOCR

private void addBooleanProperty(String com){
  JCheckBox checkbox=new JCheckBox(ENVIRONMENT.getTranslation(com),ENVIRONMENT.getBoolean(com));
  checkbox.setAlignmentX(0);
  checkbox.setActionCommand(com);
  checkbox.addActionListener(this);
  add(checkbox);
}
private void addIntegerProperty(String com){

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

private void initDialog() {
  this.getContentPane().setLayout(new BorderLayout());
  final int configCount = (SampleSaveConfiguration.SAVE_CONFIG_NAMES.size() / 3) + 1;
  log.debug("grid panel is {} by {}", 3, configCount);
  JPanel checkPanel = new JPanel(new GridLayout(configCount, 3));
  for (final String name : SampleSaveConfiguration.SAVE_CONFIG_NAMES) {
    try {
      JCheckBox check = new JCheckBox(
          JMeterUtils.getResString(RESOURCE_PREFIX + name),
          getSaveState(SampleSaveConfiguration.getterName(name)));
      check.addActionListener(this);
      final String actionCommand = SampleSaveConfiguration.setterName(name); // $NON-NLS-1$
      check.setActionCommand(actionCommand);
      if (!functors.containsKey(actionCommand)) {
        functors.put(actionCommand, new Functor(actionCommand));
      }
      checkPanel.add(check, BorderLayout.NORTH);
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
      log.warn("Problem creating save config dialog", e);
    }
  }
  getContentPane().add(checkPanel, BorderLayout.NORTH);
  JButton exit = new JButton(JMeterUtils.getResString("done")); // $NON-NLS-1$
  this.getContentPane().add(exit, BorderLayout.SOUTH);
  exit.addActionListener(e -> dispose());
}

相关文章

JCheckBox类方法