Java Code Examples for javax.swing.JCheckBox#getText()

The following examples show how to use javax.swing.JCheckBox#getText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeTemplatesOperator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public CodeTemplatesOperator setContext(Set<String> set) {
    JTabbedPaneOperator tabbedPane = getTabbedPane();
    tabbedPane.selectPage("Contexts");
    ContainerOperator<JEditorPane> selectedComponent = new ContainerOperator<>((Container)tabbedPane.getSelectedComponent());
    JListOperator list = new JListOperator(selectedComponent);
    for (int i = 0; i < list.getModel().getSize(); i++) {
        JCheckBox checkBox = (JCheckBox) list.getRenderedComponent(i);
        String contextName = checkBox.getText();
        list.scrollToItem(i);
        if(!checkBox.isSelected() && set.contains(contextName)) {
            list.selectItem(i);
        } else if(checkBox.isSelected() && !set.contains(contextName)) {
            list.selectItem(i);
        }            
    }   
    return this;
    
}
 
Example 2
Source File: FireSimulatorGUI.java    From rcrs-server with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void updateStringData() {
	String str = "";
	for (JCheckBox chb : layerCheckBoxes) {
		if (chb.isSelected()) {
			PaintEvent paintEvent = new PaintEvent(null, null, simulator, world, selectedBuilding, mouseX, mouseY);
			String s = GUILayerFactory.getInstance().getLayer(chb.getText()).getString(paintEvent);
			if (s != null) {
				str += chb.getText() + ": ";
				str += "\n";
				str += s;
				str += "\n";
				str += "\n";
			}
		}
	}
	stringDataTextArea.setText(str);
}
 
Example 3
Source File: DisksWindow.java    From DiskBrowser with GNU General Public License v3.0 6 votes vote down vote up
private String getFilterText ()
// ---------------------------------------------------------------------------------//
{
  StringBuilder filterText = new StringBuilder ();

  for (JCheckBox box : boxes)
    if (box.isSelected ())
    {
      String text = box.getText ();
      int pos = text.indexOf (' ');
      filterText.append (text.substring (0, pos) + "|");
    }

  if (filterText.length () > 0)
    filterText.deleteCharAt (filterText.length () - 1);

  return filterText.toString ();
}
 
Example 4
Source File: TaskReloadConfigPanel.java    From gameserver with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
	if ( e.getActionCommand().equals(ActionName.OK.name()) ) {
		
		String gameServer = this.gameServerField.getSelectedItem().toString();
		String gameServerPort = this.gameServerPort.getSelectedItem().toString();
		
		BceReloadConfig.Builder builder = BceReloadConfig.newBuilder();
		for ( JCheckBox checkBox : backupCollections ) {
			if ( checkBox.isSelected() ) {
				String config = checkBox.getText();
				builder.addConfigname(config);
			}
		}
		GameClient client = new GameClient(gameServer, StringUtil.toInt(gameServerPort, 3443));
		XinqiMessage msg = new XinqiMessage();
		msg.payload = builder.build();
		client.sendMessageToServer(msg);
		JOptionPane.showConfirmDialog(this, "已经通知"+gameServer+"重新装载配置文件");
	}
}
 
Example 5
Source File: JCheckBoxTree.java    From MeteoInfo with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object getCellEditorValue() {
    JCheckBox checkbox = renderer.getLeafRenderer();
    CheckBoxNode checkBoxNode = new CheckBoxNode(checkbox.getText(),
            checkbox.isSelected());
    return checkBoxNode;
}
 
Example 6
Source File: MuleModulesCheckBoxList.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
public Module[] getSelectedModules(Project p) {
    List<Module> selectedModules = new ArrayList<>();
    DefaultListModel<JCheckBox> myModel = (DefaultListModel<JCheckBox>)getModel();
    Enumeration<JCheckBox> elements = myModel.elements();
    while (elements.hasMoreElements()) {
        JCheckBox nextElement = elements.nextElement();
        if (nextElement.isSelected()) {
            String name = nextElement.getText();
            Module m = ModuleManager.getInstance(p).findModuleByName(name);
            selectedModules.add(m);
        }
    }

    return selectedModules.toArray(new Module[] {});
}
 
Example 7
Source File: JCheckBoxBuilderTest.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
@Test
void titleIsSet() {
  final JCheckBox checkBox = new JCheckBoxBuilder(TITLE).build();

  final String result = checkBox.getText();

  assertThat(result, is(TITLE));
}
 
Example 8
Source File: JCheckBoxBuilderTest.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
@Test
void noTitle() {
  final JCheckBox checkBox = new JCheckBoxBuilder().build();

  final String result = checkBox.getText();

  assertThat(result, emptyString());
}
 
Example 9
Source File: CheckBoxNodeEditor.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @return
 */
@Override
public Object getCellEditorValue() {
    JCheckBox checkbox = renderer.getLeafRenderer();
    CheckBoxNode checkBoxNode = new CheckBoxNode(checkbox.getText(), checkbox.isSelected(), true);
    return checkBoxNode;
}
 
Example 10
Source File: NeembuuUploader.java    From neembuu-uploader with GNU General Public License v3.0 5 votes vote down vote up
static JCheckBox findByName(Map<JCheckBox,SmallModuleEntry> m,String name){
    Iterator<JCheckBox> it = m.keySet().iterator();
    while (it.hasNext()) {
        JCheckBox cb = it.next(); if(cb==null || cb.getText()==null){
            continue;
        }
        if(cb.getText().equalsIgnoreCase(name)){
            return cb;
        }
        //.addActionListener(checkBoxActionListener);
    }return null;
}