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

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

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

JCheckBox.getText介绍

暂无

代码示例

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

public ArrayList<String> getSelectedPacks() {
  ArrayList<String> returnVal = new ArrayList<>();
  for (Component pack: pnlPacks.getComponents()){
    JCheckBox thePack = (JCheckBox) pack;
    if (thePack.isSelected()){
      returnVal.add(thePack.getText());
    }
  }
  return returnVal;
}

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

public void setSelectedPacks(ArrayList<String> packs){
  if (!boxesCreated){
    createCheckboxes();
  }
  for (Component pack : pnlPacks.getComponents()) {
    JCheckBox thePack = (JCheckBox) pack;
    if (packs.contains(thePack.getText())) {
      thePack.setSelected(true);
    } else{
      thePack.setSelected(false);
    }
  }
}

代码示例来源:origin: igvteam/igv

public String getText() {
  if (jCheckBox1 != null) {
    return jCheckBox1.getText();
  } else {
    return null;
  }
}

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

for( int i=0; i<checkBoxPanel.getComponentCount(); i++ ) {
 JCheckBox checkBox = (JCheckBox)checkBoxPanel.getComponent( i );
 if( checkBox.isSelected() ) {
   String option = checkBox.getText();
   // append text, etc
 }
}

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

JCheckBox[] boxes = new JCheckBox[] {chkDef1,chkDef2,chkDef3,chkDef4}
for (JCheckBox box : boxes) {
  if (box.isSelected()) {
    actual = box.getText();
    break; // We don't want to loop unnecessarily
  }
}

代码示例来源:origin: org.apache.uima/uimaj-tools

@Override
 public int compare(JCheckBox arg0, JCheckBox arg1) {
  return arg0.getText().toLowerCase().compareTo(arg1.getText().toLowerCase());
 }
});

代码示例来源:origin: org.activecomponents.jadex/jadex-runtimetools-swing

public void customResultAvailable(Set<String> localtypes)
      {
        for(int i=0; i<cbmechanisms.length; i++)
        {
//                    System.out.println("test: "+cbmechanisms[i].getText()+" "+localtypes);
          cbmechanisms[i].setSelected(localtypes.contains(cbmechanisms[i].getText()));
        }
      }

代码示例来源:origin: SAMLRaider/SAMLRaider

public void setKeyUsage(List<String> keyUsage) {
  for (JCheckBox j : jbxKeyUsages) {
    j.setSelected(false);
    for (String s : keyUsage) {
      if (j.getText().equals(s)) {
        j.setSelected(true);
        continue; // Otherwise in the next round it would be false!
      }
    }
  }
}

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

ArrayList<String> titlesArr = new ArrayList<String>(filmListe.size());
 for (JCheckBox checkbox : filmListe) {
   if (checkbox.isSelected()) {
     titlesArr.add(checkbox.getText());
   }
 }

代码示例来源:origin: org.gephi/import-plugin-ui

public String[] getColumnsToImport() {
  ArrayList<String> columns = new ArrayList<>();
  for (JCheckBox columnCheckBox : columnsCheckBoxes) {
    if (columnCheckBox.isSelected()) {
      columns.add(columnCheckBox.getText());
    }
  }
  return columns.toArray(new String[0]);
}

代码示例来源:origin: matsim-org/matsim

@Override
public void itemStateChanged(ItemEvent e) {
  JCheckBox source = (JCheckBox)e.getItemSelectable();
  if (source.getText().equals("leg only")) {
    tripOnly = !tripOnly;
  } else if (source.getText().equals("only vehicles on the link now")) {
    nowOnly = ! nowOnly;
  }
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/beanshell-activity-ui

public void itemStateChanged(ItemEvent e) {
    JCheckBox box = (JCheckBox) e.getSource();
    if (e.getStateChange() == ItemEvent.SELECTED) {
      localDependencies.add(box.getText());
    } else if (e.getStateChange() == ItemEvent.DESELECTED) {
      localDependencies.remove(box.getText());
    }
    updateWarning();
  }
});

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

public void setSelectedLibraries(Set<AppEngineStandardMavenLibrary> mavenLibraries) {
 Set<String> availableLibraryNames =
   mavenLibraries.stream().map(AppEngineStandardMavenLibrary::getDisplayName).collect(toSet());
 libraries.forEach(
   checkbox -> checkbox.setSelected(availableLibraryNames.contains(checkbox.getText())));
}

代码示例来源:origin: matsim-org/matsim

@Override
public void itemStateChanged(ItemEvent e) {
  System.err.println("itemStateChange ...") ;
  JCheckBox source = (JCheckBox)e.getItemSelectable();
  if (source.getText().equals(INCLUDE_ROUTES)) {
    includeRoutes = !includeRoutes ;
    System.err.println("changing includeRoutes") ;
  }
}

代码示例来源:origin: edu.toronto.cs.savant/savant-core

void updateControls() {
  Set<String> newControls = new HashSet<String>();
  for (Component c: checksPanel.getComponents()) {
    if (((JCheckBox)c).isSelected()) {
      newControls.add(((JCheckBox)c).getText());
    }
  }
  controller.setControls(newControls);
}

代码示例来源:origin: matsim-org/matsim

@Override
public void itemStateChanged(ItemEvent e) {
  JCheckBox source = (JCheckBox)e.getItemSelectable();
  if (source.getText().equals("multiple select")) {
    this.config.setMultipleSelect(e.getStateChange() != ItemEvent.DESELECTED);
  }
}

代码示例来源:origin: us.ihmc/Plotting

@Override
 public void itemStateChanged(ItemEvent e)
 {
   String name = checkBox.getText();
   boolean visible = checkBox.isSelected();
   artifactList.get(name).setVisible(visible);
   plotter.update();
 }
});

代码示例来源:origin: hneemann/Digital

private InverterConfig getInverterConfig() {
    InverterConfig ic = new InverterConfig();
    for (JCheckBox cb : boxes) {
      if (cb.isSelected())
        ic.add(cb.getText());
    }
    return ic;
  }
}

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

private void initComponents() {
  setLayout(new BorderLayout());
  checkBox = new JCheckBox();
  if (rbLabel != null) {
    Mnemonics.setLocalizedText(checkBox, rbLabel);
  }
  
  checkBox.getAccessibleContext().setAccessibleName( checkBox.getText());
  checkBox.getAccessibleContext().setAccessibleDescription(
      checkBox.getText());
  
  checkBox.addActionListener(this);
  add(checkBox, BorderLayout.CENTER);
}

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

ItemListener listener = new ItemListener()
{
  public void itemStateChanged(ItemEvent event)
  {
    JCheckBox checkBox = (JCheckBox)event.getSource();
    textBox.setText( checkBox.getText() );
  }
};

相关文章

JCheckBox类方法