java.awt.Checkbox.addItemListener()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(185)

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

Checkbox.addItemListener介绍

暂无

代码示例

代码示例来源:origin: sc.fiji/TrakEM2_

/** A helper for GenericDialog checkboxes to control other the enabled state of other GUI elements in the same dialog. */
static public final void addEnablerListener(final Checkbox master, final Component[] enable, final Component[] disable) {
  master.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(final ItemEvent ie) {
      if (ie.getStateChange() == ItemEvent.SELECTED) {
        process(enable, true);
        process(disable, false);
      } else {
        process(enable, false);
        process(disable, true);
      }
    }
    private void process(final Component[] c, final boolean state) {
      if (null == c) return;
      for (int i=0; i<c.length; i++) c[i].setEnabled(state);
    }
  });
}

代码示例来源:origin: fiji/Stitching

public static final void addEnablerListener(/* final GenericDialog gd, */final Checkbox master, final Component[] enable, final Component[] disable)
{
  master.addItemListener(new ItemListener()
  {
    @Override
    public void itemStateChanged(ItemEvent ie)
    {
      if (ie.getStateChange() == ItemEvent.SELECTED)
      {
        process(enable, true);
        process(disable, false);
      }
      else
      {
        process(enable, false);
        process(disable, true);
      }
    }
    private void process(final Component[] c, final boolean state)
    {
      if (null == c) return;
      for (int i = 0; i < c.length; i++)
      {
        c[i].setEnabled(state);
        // c[i].setVisible(state);
      }
      // gd.pack();
    }
  });
}

代码示例来源:origin: fiji/Stitching

public static final void addInverseEnablerListener(/* final GenericDialog gd, */final Checkbox master, final Component[] enable, final Component[] disable)
  master.addItemListener(new ItemListener()

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

Kalin.addItemListener(this);
add(Kalin);

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

c3 = new Checkbox("mumbai");
add(c3);
c1.addItemListener(this);
c2.addItemListener(this);
c3.addItemListener(this);

代码示例来源:origin: uk.org.mygrid.taverna.scufl/scufl-ui

public Component getCustomiser(DataThing dataThing)
{
  try {
    Box editor = Box.createVerticalBox();
    CheckboxGroup cbg = new CheckboxGroup();
    BeanInfo beanInfo = Introspector.getBeanInfo(
        dataThing.getDataObject().getClass());
    PropertyDescriptor[] props = beanInfo.getPropertyDescriptors();
    for(int i = 0; i < props.length; i++) {
      final PropertyDescriptor prop = props[i];
      Checkbox cb = new Checkbox(prop.getName(), false, cbg);
      cb.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e)
        {
          if (e.getStateChange() == e.SELECTED) {
            LOG.info("Selecting property " + prop + " with read method " + prop.getReadMethod());
            setMethod(prop.getReadMethod());
          }
        }
      });
      editor.add(cb);
    }
    return editor;
  } catch (IntrospectionException e) {
    return null;
  }
}

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

c1.addItemListener(this);
c2.addItemListener(this);

代码示例来源:origin: sc.fiji/MTrackJ_

public void addCheckbox(String label, boolean defaultValue) {
  
  String label2 = label;
  if (label2.indexOf('_')!=-1) label2 = label2.replace('_', ' ');
  if (checkbox==null) {
    checkbox = new Vector(4);
    c.insets = getInsets(10,10,0,0);
  } else c.insets = getInsets(0,10,0,0);
  c.gridx = 0; c.gridy = y;
  c.gridwidth = 2;
  c.anchor = GridBagConstraints.WEST;
  Checkbox cb = new Checkbox(" "+label2);
  cb.setFont(font);
  grid.setConstraints(cb, c);
  cb.setState(defaultValue);
  cb.addItemListener(this);
  cb.addKeyListener(this);
  add(cb);
  checkbox.addElement(cb);
  y++;
}

代码示例来源:origin: org.w3c.jigsaw/jigsaw

private void init() {
setLayout( new BorderLayout());
label    = new Label(getString(true));
checkbox = new Checkbox();
checkbox.setState(true);
checkbox.addItemListener(this);
add(checkbox,"West");
add(label,"Center");
size = new Dimension(75,30);
}

代码示例来源:origin: sc.fiji/MTrackJ_

checkbox.addElement(cb);
cb.setState(defaultValues[i1]);
if (addListeners) cb.addItemListener(this);
panel.add(cb);
i1++;

代码示例来源:origin: net.imagej/ij

Checkbox cb = new Checkbox(label2);
cb.setState(defaultValue);
cb.addItemListener(this);
cb.addKeyListener(this);
add(cb, c);

代码示例来源:origin: net.imagej/ij

for (int i=0; i<n; i++) {
  Checkbox cb = new Checkbox(items[i],cg,items[i].equals(defaultItem));
  cb.addItemListener(this);
  panel.add(cb);

代码示例来源:origin: net.preibisch/multiview-reconstruction

this.anisoCheckbox.addItemListener( new ItemListener() { @Override
  public void itemStateChanged(ItemEvent e) { update(); } });

代码示例来源:origin: net.jxta/jxta-jxse

RdvPanel(boolean useARdv, boolean onlySeeds) {
  super("Rendezvous Settings");
  useRdv = new Checkbox("Use a rendezvous", null, useARdv);
  useOnlySeeds = new Checkbox("Use only configured seeds", null, onlySeeds);
  seeds = new HostListPanel("Seeds", "Rendezvous seed peers", true, false);
  seeding = new HostListPanel("Seeding", "Rendezvous seeding URIs", true, false);
  GridBagConstraints c1 = new GridBagConstraints();
  c1.gridx = 0;
  c1.gridy = 0;
  c1.anchor = GridBagConstraints.LINE_START;
  add(useRdv, c1);
  useRdv.addItemListener(this);
  c1.gridx++;
  c1.anchor = GridBagConstraints.LINE_END;
  add(useOnlySeeds, c1);
  c1.gridx = 0;
  c1.gridy++;
  c1.gridwidth = 2;
  c1.weightx = 1.0;
  c1.fill = GridBagConstraints.HORIZONTAL;
  c1.anchor = GridBagConstraints.LINE_START;
  add(seeding, c1);
  c1.gridy++;
  add(seeds, c1);
}

代码示例来源:origin: net.jxta/jxta-jxse

useMe.addItemListener(this);

代码示例来源:origin: net.jxta/jxta-jxse

public RelayPanel(boolean useARelay, boolean onlySeeds) {
  super("Relay Settings");
  useRelay = new Checkbox("Use a relay", null, useARelay);
  useOnlySeeds = new Checkbox("Use only configured seeds", null, onlySeeds);
  useOnlySeeds.setEnabled(useARelay);
  seeds = new HostListPanel("Seeds", "Relay seed peers", useARelay, false);
  seeding = new HostListPanel("Seeding", "Relay seeding URIs", useARelay, false);
  GridBagConstraints c1 = new GridBagConstraints();
  c1.gridx = 0;
  c1.gridy = 0;
  c1.anchor = GridBagConstraints.LINE_START;
  add(useRelay, c1);
  useRelay.addItemListener(this);
  c1.gridx++;
  c1.anchor = GridBagConstraints.LINE_END;
  add(useOnlySeeds, c1);
  c1.gridx = 0;
  c1.gridy++;
  c1.gridwidth = 2;
  c1.weightx = 1.0;
  c1.fill = GridBagConstraints.HORIZONTAL;
  c1.anchor = GridBagConstraints.LINE_START;
  add(seeding, c1);
  c1.gridy++;
  add(seeds, c1);
}

代码示例来源:origin: sc.fiji/Image_5D

void addTiledSelectorPanel() {
  if (channelSelectorOverlay == null) {
    channelSelectorOverlay = new ChannelSelectorOverlay(this);
  }
  if (tiledSelectorPanel == null) {
    tiledSelectorPanel = new Panel(new BorderLayout());
  }
  if (allGrayInTilesBox == null) {
    allGrayInTilesBox = new Checkbox("all gray", displayGrayInTiles);
    allGrayInTilesBox.addItemListener(this);
    allGrayInTilesBox.addKeyListener(win);
    allGrayInTilesBox.addKeyListener(ij);
    allGrayInTilesBox.addKeyListener(win);
  }
  if (channelSelectorOverlay != null) selectorPanel
    .remove(channelSelectorOverlay);
  if (scrollbarWL != null) selectorPanel.remove(scrollbarWL);
  tiledSelectorPanel.add(allGrayInTilesBox, BorderLayout.NORTH);
  tiledSelectorPanel.add(channelSelectorOverlay, BorderLayout.CENTER);
  selectorPanel.add(tiledSelectorPanel, BorderLayout.CENTER);
  win.pack();
  selectorPanel.repaint();
}

代码示例来源:origin: net.imagej/ij

cCoords.addItemListener(this);
p.add(cCoords);
cScaling.addItemListener(this);
p.add(cScaling);

代码示例来源:origin: ravn/jsocks

/**
 * Creates SOCKS configuration dialog and initialises it to given proxy.
 */
public SocksDialog(Frame parent, SocksProxyBase init_proxy) {
  super(parent, "Proxy Configuration", true);
  warning_dialog = new Dialog(parent, "Warning", true);
  guiInit();
  setResizable(false);
  addWindowListener(this);
  final Component[] comps = getComponents();
  for (int i = 0; i < comps.length; ++i) {
    if (comps[i] instanceof Button) {
      ((Button) comps[i]).addActionListener(this);
    } else if (comps[i] instanceof TextField) {
      ((TextField) comps[i]).addActionListener(this);
    } else if (comps[i] instanceof Checkbox) {
      ((Checkbox) comps[i]).addItemListener(this);
    }
  }
  proxy = init_proxy;
  if (proxy != null) {
    doInit(proxy);
  } else {
    ir = new InetRange();
  }
  dismiss_button.addActionListener(this);
  warning_dialog.addWindowListener(this);
}

代码示例来源:origin: sc.fiji/Image_5D

displayGrayBox.setState(i5d.getChannelDisplayProperties(
  cControl.currentChannel).isDisplayedGray());
displayGrayBox.addItemListener(this);
add(displayGrayBox, BorderLayout.NORTH);

相关文章