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

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

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

JToggleButton.getName介绍

暂无

代码示例

代码示例来源:origin: raydac/netbeans-mmd-plugin

@Nullable
public String getSelectedName() {
 final Enumeration<AbstractButton> iterator = this.group.getElements();
 while (iterator.hasMoreElements()) {
  final JToggleButton button = (JToggleButton) iterator.nextElement();
  if (button.isSelected()) {
   return button.getName();
  }
 }
 return null;
}

代码示例来源:origin: RPTools/maptool

public Map<String, Boolean> getExportSettings() {
  Map<String, Boolean> settings = new HashMap<String, Boolean>(16);
  FormAccessor fa = interactPanel.getFormAccessor();
  Iterator<?> iter = fa.beanIterator(true);
  while (iter.hasNext()) {
    Object obj = iter.next();
    if (obj instanceof JToggleButton) {
      JToggleButton jtb = (JToggleButton) obj;
      settings.put(jtb.getName(), jtb.isSelected());
    }
  }
  return settings;
}

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

private ItemLayouts getComponentsBitmask() {
  ItemLayouts _layouts = new ItemLayouts(0);
  for (JToggleButton button : guiItems) {
    if (button.isSelected()) {
      _layouts.addToBitmask(bits.get(Integer.valueOf(button.getName())), true);
    }
  }
  return _layouts;
}

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

private void setLayoutDefault(boolean layoutDefault) {
  // need to disable all groups except default button
  boolean nonDefault = !layoutDefault;
  for (Integer value : bits.keySet()) {
    for (JToggleButton tButton : guiItems) {
      if (tButton.getName().equals(Integer.toString(value))) {
        tButton.setEnabled(nonDefault);
      }
    }
  }
  defaultCheckBox.setEnabled(true);
  // don't forget at horizontal/vertical none settings
  horizontalAlignmentNoneCheckBox.setEnabled(nonDefault);
  verticalAlignmentNoneCheckBox.setEnabled(nonDefault);
}

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

public void itemStateChanged(ItemEvent e) {
  Object component = e.getItemSelectable();
  JToggleButton tButton;
  if (!(component instanceof JToggleButton)) {
    return;
  } else {
    tButton = (JToggleButton) component;
  }
  String value =  tButton.getName();
  if (value.equals(defaultCheckBox.getName())) {
    boolean selected = (e.getStateChange() == ItemEvent.SELECTED);
    setLayoutDefault(selected);
    int newBitmask = 0;
    if (!selected) {
      newBitmask = getComponentsBitmask().getBitmask();
    }
    bitMask = newBitmask;
  } else {
    BitmaskItem bitmaskItem = bits.get(new Integer(String.valueOf(value)));
    assert (bitmaskItem != null);
    boolean state = (e.getStateChange() == ItemEvent.SELECTED);
    bitMask = layouts.addToBitmask(bitmaskItem, state);
  }
}

相关文章

JToggleButton类方法