List of usage examples for javax.swing JRadioButton isSelected
public boolean isSelected()
From source file:com.sec.ose.osi.ui.frm.main.identification.codematch.table.JPanCMTableArea.java
private void mouseClickedAction(JTableMatchedInfo jTableMatchedInfo, MouseEvent e) { jPanCodeMatchMain.resetNavigator();//from ww w.jav a2s .c o m jPanCodeMatchMain.resetSelectSnippetNum(); JRadioButton rdbtnOpt1IConform = jPanCodeMatchMain.getJRadioButtonOpt1(); int prevSelectedCodeMatchTableIndex = jPanCodeMatchMain.getPrevSelectedCodeMatchTableIndex(); int selectedRow = jTableMatchedInfo.getSelectedRow(); IdentifyMediator.getInstance().updateUIOKResetButtonForSMCM(jTableMatchedInfo, selectedRow); if (e.getClickCount() != IdentificationConstantValue.MOUSE_DOUBLE_CLICK) { if (rdbtnOpt1IConform.isSelected()) { String selectedLicenseName = (String) jTableMatchedInfo.getValueAt(selectedRow, 2); selectedLicenseName = DCCodeMatch.getOriginValue(selectedLicenseName); IdentifyMediator.getInstance().setSelectedLicenseName(selectedLicenseName); log.debug("selectedLicenseName by mouse selection : " + selectedLicenseName); } int lSelectedCodeMatchTableIndex = jTableMatchedInfo.getSelectedRow(); if (prevSelectedCodeMatchTableIndex != lSelectedCodeMatchTableIndex) { if (jTableMatchedInfo.getSelectedRow() >= 0 && jTableMatchedInfo.getModel().getColumnCount() > 5) { jPanCodeMatchMain.updateSourceCodeView(); } prevSelectedCodeMatchTableIndex = lSelectedCodeMatchTableIndex; } return; } }
From source file:carolina.pegaLatLong.LatLong.java
private void btnGerarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGerarActionPerformed // TODO add your handling code here: List<JRadioButton> radios = new ArrayList<>(); JPanel painel = new JPanel(); JRadioButton btnEncontrados = new JRadioButton("Encontrados \n"); JRadioButton btnNaoEncontrados = new JRadioButton("No encontrados"); JRadioButton btnEncontradosMais = new JRadioButton("Mais de um encontrados"); JRadioButton btnTudo = new JRadioButton("Tudo"); ButtonGroup btnGroup = new ButtonGroup(); btnGroup.add(btnTudo);/*from ww w . j av a 2 s .c o m*/ btnGroup.add(btnEncontrados); btnGroup.add(btnNaoEncontrados); btnGroup.add(btnEncontradosMais); //painel.add(btnTudo); painel.add(btnEncontrados); painel.add(btnNaoEncontrados); painel.add(btnEncontradosMais); JOptionPane.showMessageDialog(null, painel, "Escolha uma opo:", JOptionPane.QUESTION_MESSAGE); if (btnTudo.isSelected()) { System.err.println("Tudo selecionado!"); } else if (btnNaoEncontrados.isSelected()) { System.err.println("No encontrados!"); } else if (btnEncontrados.isSelected()) { try { geraCsv(listaResultado); } catch (IOException ex) { Logger.getLogger(LatLong.class.getName()).log(Level.SEVERE, null, ex); } } else if (btnEncontradosMais.isSelected()) { System.err.println("Encontrados mais"); } }
From source file:configuration.Util.java
public static void buttonEventSpinner(workflow_properties properties, javax.swing.JRadioButton b, javax.swing.JSpinner s) { if (b == null) { properties.put(s.getName(), s.getValue()); } else {// w ww.ja va 2 s.c o m if (b.isSelected() == true) { if (s == null) { properties.put(b.getName(), b.isSelected()); } else { s.setEnabled(true); properties.put(s.getName(), s.getValue()); properties.put(b.getName(), s.getValue()); } } } }
From source file:configuration.Util.java
public static void buttonEventText(workflow_properties properties, javax.swing.JRadioButton b, javax.swing.JTextField t) { if (b == null) { properties.put(t.getName(), t.getText()); } else {/* w ww.j a va 2 s.com*/ if (b.isSelected() == true) { if (t == null) { properties.put(b.getName(), b.isSelected()); } else { t.setEnabled(true); properties.put(t.getName(), t.getText()); properties.put(b.getName(), t.getText()); } } } }
From source file:userInterface.HospitalAdminRole.ManagePatientsJPanel.java
private void submitVisitStatusBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitVisitStatusBtnActionPerformed Enumeration<AbstractButton> bg = visitBtnGrp.getElements(); while (bg.hasMoreElements()) { JRadioButton jrd = (JRadioButton) bg.nextElement(); int selectedRow = vitalSignAlertsTable.getSelectedRow(); Date currentDate = new Date(); HosptoHouseWorkRequest request = (HosptoHouseWorkRequest) vitalSignAlertsTable.getValueAt(selectedRow, 0);// w w w . j a v a 2 s . c o m if (jrd.isSelected()) { if (selectedRow >= 0) { if (request.getAppointmentDate() != null) { if (jrd.getText().equals("Visited")) { if (!request.getStatus().equals("Cancelled")) { if (request.getAppointmentDate().compareTo(currentDate) < 0) { if (request.getStatus().equals("Confirmed")) { request.setStatus("Visited"); populateAlertFamilyTable(); } else if (request.getStatus().equals("Cancelled")) { JOptionPane.showMessageDialog(null, "Appointment is already cancelled", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } else if (request.getStatus().equals("Dint Show Up")) { JOptionPane.showMessageDialog(null, "Person dint show up.", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Check after the appointment time", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); return; } } else { JOptionPane.showMessageDialog(null, "Appointment is already cancelled", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else if (jrd.getText().equals("Dint Show Up")) { // HosptoHouseWorkRequest request = (HosptoHouseWorkRequest)vitalSignAlertsTable.getValueAt(selectedRow, 0); if (!request.getStatus().equals("Cancelled")) { if (request.getAppointmentDate().compareTo(currentDate) < 0) { if (request.getStatus().equals("Confirmed")) { request.setStatus("Dint Show Up"); populateAlertFamilyTable(); } else if (request.getStatus().equals("Visited")) { JOptionPane.showMessageDialog(null, "Person already visited.", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Check after the appointment time", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Appointment is already cancelled", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else if (jrd.getText().equals("Cancel")) { // HosptoHouseWorkRequest request = (HosptoHouseWorkRequest)vitalSignAlertsTable.getValueAt(selectedRow, 0); if (!request.getStatus().equals("Cancelled")) { if (request.getAppointmentDate().compareTo(currentDate) > 0) { if (request.getStatus().equals("Confirmed")) { request.setStatus("Cancelled"); populateAlertFamilyTable(); } else { request.setStatus("Cancelled"); populateAlertFamilyTable(); } } else { JOptionPane.showMessageDialog(null, "Can be cancelled before appointment time", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Appointment is already cancelled", "WARNING", JOptionPane.WARNING_MESSAGE); } } } else { JOptionPane.showMessageDialog(null, "Appointment not requested", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Kindly select a row!", "WARNING", JOptionPane.WARNING_MESSAGE); } } } }
From source file:net.sf.jabref.openoffice.AutoDetectPaths.java
private boolean autoDetectPaths() { if (OS.WINDOWS) { List<File> progFiles = findProgramFilesDir(); File sOffice = null;/* ww w .j av a 2 s. c o m*/ List<File> sofficeFiles = new ArrayList<>(); for (File dir : progFiles) { if (fileSearchCancelled) { return false; } sOffice = findFileDir(dir, "soffice.exe"); if (sOffice != null) { sofficeFiles.add(sOffice); } } if (sOffice == null) { JOptionPane.showMessageDialog(parent, Localization.lang( "Unable to autodetect OpenOffice/LibreOffice installation. Please choose the installation directory manually."), Localization.lang("Could not find OpenOffice/LibreOffice installation"), JOptionPane.INFORMATION_MESSAGE); JFileChooser jfc = new JFileChooser(new File("C:\\")); jfc.setDialogType(JFileChooser.OPEN_DIALOG); jfc.setFileFilter(new javax.swing.filechooser.FileFilter() { @Override public boolean accept(File file) { return file.isDirectory(); } @Override public String getDescription() { return Localization.lang("Directories"); } }); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jfc.showOpenDialog(parent); if (jfc.getSelectedFile() != null) { sOffice = jfc.getSelectedFile(); } } if (sOffice == null) { return false; } if (sofficeFiles.size() > 1) { // More than one file found DefaultListModel<File> mod = new DefaultListModel<>(); for (File tmpfile : sofficeFiles) { mod.addElement(tmpfile); } JList<File> fileList = new JList<>(mod); fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fileList.setSelectedIndex(0); FormBuilder b = FormBuilder.create() .layout(new FormLayout("left:pref", "pref, 2dlu, pref, 4dlu, pref")); b.add(Localization.lang("Found more than one OpenOffice/LibreOffice executable.")).xy(1, 1); b.add(Localization.lang("Please choose which one to connect to:")).xy(1, 3); b.add(fileList).xy(1, 5); int answer = JOptionPane.showConfirmDialog(null, b.getPanel(), Localization.lang("Choose OpenOffice/LibreOffice executable"), JOptionPane.OK_CANCEL_OPTION); if (answer == JOptionPane.CANCEL_OPTION) { return false; } else { sOffice = fileList.getSelectedValue(); } } else { sOffice = sofficeFiles.get(0); } return setupPreferencesForOO(sOffice.getParentFile(), sOffice, "soffice.exe"); } else if (OS.OS_X) { File rootDir = new File("/Applications"); File[] files = rootDir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory() && ("OpenOffice.org.app".equals(file.getName()) || "LibreOffice.app".equals(file.getName()))) { rootDir = file; break; } } } File sOffice = findFileDir(rootDir, SOFFICE_BIN); if (fileSearchCancelled) { return false; } if (sOffice == null) { return false; } else { return setupPreferencesForOO(rootDir, sOffice, SOFFICE_BIN); } } else { // Linux: String usrRoot = "/usr/lib"; File inUsr = findFileDir(new File(usrRoot), SOFFICE); if (fileSearchCancelled) { return false; } if (inUsr == null) { inUsr = findFileDir(new File("/usr/lib64"), SOFFICE); if (inUsr != null) { usrRoot = "/usr/lib64"; } } if (fileSearchCancelled) { return false; } File inOpt = findFileDir(new File("/opt"), SOFFICE); if (fileSearchCancelled) { return false; } if ((inUsr != null) && (inOpt == null)) { return setupPreferencesForOO(usrRoot, inUsr, SOFFICE_BIN); } else if (inOpt != null) { if (inUsr == null) { return setupPreferencesForOO("/opt", inOpt, SOFFICE_BIN); } else { // Found both JRadioButton optRB = new JRadioButton(inOpt.getPath(), true); JRadioButton usrRB = new JRadioButton(inUsr.getPath(), false); ButtonGroup bg = new ButtonGroup(); bg.add(optRB); bg.add(usrRB); FormBuilder b = FormBuilder.create() .layout(new FormLayout("left:pref", "pref, 2dlu, pref, 2dlu, pref ")); b.add(Localization.lang( "Found more than one OpenOffice/LibreOffice executable. Please choose which one to connect to:")) .xy(1, 1); b.add(optRB).xy(1, 3); b.add(usrRB).xy(1, 5); int answer = JOptionPane.showConfirmDialog(null, b.getPanel(), Localization.lang("Choose OpenOffice/LibreOffice executable"), JOptionPane.OK_CANCEL_OPTION); if (answer == JOptionPane.CANCEL_OPTION) { return false; } if (optRB.isSelected()) { return setupPreferencesForOO("/opt", inOpt, SOFFICE_BIN); } else { return setupPreferencesForOO(usrRoot, inUsr, SOFFICE_BIN); } } } } return false; }
From source file:PVGraph.java
private JPanel makeCommonButtonsPanel(final PVGraphView view) { JPanel commonButtonsPanel = new JPanel(); commonButtonsPanel.setBorder(new EtchedBorder()); JButton newGraphButton = new JButton("New Graph"); newGraphButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { new PVGraph((Calendar) PVGraph.this.date.clone(), tabPane.getSelectedIndex()); }//from w w w. j a v a2 s .c om }); JButton runSmatoolButton = new JButton("Run smatool"); runSmatoolButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { runSmatool(); view.updateChart(); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } } }); commonButtonsPanel.add(newGraphButton); if (Integer.decode(props.getProperty("smatool.havebutton", "1")) != 0) commonButtonsPanel.add(runSmatoolButton); int smatoolPeriod = Integer.decode(props.getProperty("smatool.period", "0")); if (smatoolPeriod > 0) { final JRadioButton trackDayRadioButton = new JRadioButton("Track day"); trackDayRadioButton.setSelected(trackDay); trackDayRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { trackDay = trackDayRadioButton.isSelected(); } }); commonButtonsPanel.add(trackDayRadioButton); } return commonButtonsPanel; }
From source file:net.rptools.maptool.client.functions.InputFunction.java
@Override public Object childEvaluate(Parser parser, String functionName, List<Object> parameters) throws EvaluationException, ParserException { // Extract the list of specifier strings from the parameters // "name | value | prompt | inputType | options" List<String> varStrings = new ArrayList<String>(); for (Object param : parameters) { String paramStr = (String) param; if (StringUtils.isEmpty(paramStr)) { continue; }//from w w w . j a va 2 s. c o m // Multiple vars can be packed into a string, separated by "##" List<String> substrings = new ArrayList<String>(); StrListFunctions.parse(paramStr, substrings, "##"); for (String varString : substrings) { if (StringUtils.isEmpty(paramStr)) { continue; } varStrings.add(varString); } } // Create VarSpec objects from each variable's specifier string List<VarSpec> varSpecs = new ArrayList<VarSpec>(); for (String specifier : varStrings) { VarSpec vs; try { vs = new VarSpec(specifier); } catch (VarSpec.SpecifierException se) { throw new ParameterException(se.msg); } catch (InputType.OptionException oe) { throw new ParameterException(I18N.getText("macro.function.input.invalidOptionType", oe.key, oe.value, oe.type, specifier)); } varSpecs.add(vs); } // Check if any variables were defined if (varSpecs.isEmpty()) return BigDecimal.ONE; // No work to do, so treat it as a successful invocation. // UI step 1 - First, see if a token is in context. VariableResolver varRes = parser.getVariableResolver(); Token tokenInContext = null; if (varRes instanceof MapToolVariableResolver) { tokenInContext = ((MapToolVariableResolver) varRes).getTokenInContext(); } String dialogTitle = "Input Values"; if (tokenInContext != null) { String name = tokenInContext.getName(), gm_name = tokenInContext.getGMName(); boolean isGM = MapTool.getPlayer().isGM(); String extra = ""; if (isGM && gm_name != null && gm_name.compareTo("") != 0) extra = " for " + gm_name; else if (name != null && name.compareTo("") != 0) extra = " for " + name; dialogTitle = dialogTitle + extra; } // UI step 2 - build the panel with the input fields InputPanel ip = new InputPanel(varSpecs); // Calculate the height // TODO: remove this workaround int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height; int maxHeight = screenHeight * 3 / 4; Dimension ipPreferredDim = ip.getPreferredSize(); if (maxHeight < ipPreferredDim.height) { ip.modifyMaxHeightBy(maxHeight - ipPreferredDim.height); } // UI step 3 - show the dialog JOptionPane jop = new JOptionPane(ip, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); JDialog dlg = jop.createDialog(MapTool.getFrame(), dialogTitle); // Set up callbacks needed for desired runtime behavior dlg.addComponentListener(new FixupComponentAdapter(ip)); dlg.setVisible(true); int dlgResult = JOptionPane.CLOSED_OPTION; try { dlgResult = (Integer) jop.getValue(); } catch (NullPointerException npe) { } dlg.dispose(); if (dlgResult == JOptionPane.CANCEL_OPTION || dlgResult == JOptionPane.CLOSED_OPTION) return BigDecimal.ZERO; // Finally, assign values from the dialog box to the variables for (ColumnPanel cp : ip.columnPanels) { List<VarSpec> panelVars = cp.varSpecs; List<JComponent> panelControls = cp.inputFields; int numPanelVars = panelVars.size(); StringBuilder allAssignments = new StringBuilder(); // holds all values assigned in this tab for (int varCount = 0; varCount < numPanelVars; varCount++) { VarSpec vs = panelVars.get(varCount); JComponent comp = panelControls.get(varCount); String newValue = null; switch (vs.inputType) { case TEXT: { newValue = ((JTextField) comp).getText(); break; } case LIST: { Integer index = ((JComboBox) comp).getSelectedIndex(); if (vs.optionValues.optionEquals("VALUE", "STRING")) { newValue = vs.valueList.get(index); } else { // default is "NUMBER" newValue = index.toString(); } break; } case CHECK: { Integer value = ((JCheckBox) comp).isSelected() ? 1 : 0; newValue = value.toString(); break; } case RADIO: { // This code assumes that the Box container returns components // in the same order that they were added. Component[] comps = ((Box) comp).getComponents(); int componentCount = 0; Integer index = 0; for (Component c : comps) { if (c instanceof JRadioButton) { JRadioButton radio = (JRadioButton) c; if (radio.isSelected()) index = componentCount; } componentCount++; } if (vs.optionValues.optionEquals("VALUE", "STRING")) { newValue = vs.valueList.get(index); } else { // default is "NUMBER" newValue = index.toString(); } break; } case LABEL: { newValue = null; // The variable name is ignored and not set. break; } case PROPS: { // Read out and assign all the subvariables. // The overall return value is a property string (as in StrPropFunctions.java) with all the new settings. Component[] comps = ((JPanel) comp).getComponents(); StringBuilder sb = new StringBuilder(); int setVars = 0; // "NONE", no assignments made if (vs.optionValues.optionEquals("SETVARS", "SUFFIXED")) setVars = 1; if (vs.optionValues.optionEquals("SETVARS", "UNSUFFIXED")) setVars = 2; if (vs.optionValues.optionEquals("SETVARS", "TRUE")) setVars = 2; // for backward compatibility for (int compCount = 0; compCount < comps.length; compCount += 2) { String key = ((JLabel) comps[compCount]).getText().split("\\:")[0]; // strip trailing colon String value = ((JTextField) comps[compCount + 1]).getText(); sb.append(key); sb.append("="); sb.append(value); sb.append(" ; "); switch (setVars) { case 0: // Do nothing break; case 1: parser.setVariable(key + "_", value); break; case 2: parser.setVariable(key, value); break; } } newValue = sb.toString(); break; } default: // should never happen newValue = null; break; } // Set the variable to the value we got from the dialog box. if (newValue != null) { parser.setVariable(vs.name, newValue.trim()); allAssignments.append(vs.name + "=" + newValue.trim() + " ## "); } } if (cp.tabVarSpec != null) { parser.setVariable(cp.tabVarSpec.name, allAssignments.toString()); } } return BigDecimal.ONE; // success // for debugging: //return debugOutput(varSpecs); }
From source file:emailplugin.MailCreator.java
/** * Gives the User the opportunity to specify which Desktop he uses (KDE or * Gnome)/*w w w . ja va 2s . com*/ * * @param parent * Parent Dialog * @return true if KDE or Gnome has been selected, false if the User wanted to * specify the App */ private boolean showKdeGnomeDialog(Frame parent) { final JDialog dialog = new JDialog(parent, true); dialog.setTitle(mLocalizer.msg("chooseTitle", "Choose")); JPanel panel = (JPanel) dialog.getContentPane(); panel.setLayout(new FormLayout("10dlu, fill:pref:grow", "default, 3dlu, default, 3dlu, default, 3dlu, default, 3dlu:grow, default")); panel.setBorder(Borders.DIALOG_BORDER); CellConstraints cc = new CellConstraints(); panel.add(UiUtilities.createHelpTextArea(mLocalizer.msg("cantConfigure", "Can't configure on your system")), cc.xyw(1, 1, 2)); JRadioButton kdeButton = new JRadioButton(mLocalizer.msg("kde", "I am using KDE")); panel.add(kdeButton, cc.xy(2, 3)); JRadioButton gnomeButton = new JRadioButton(mLocalizer.msg("gnome", "I am using Gnome")); panel.add(gnomeButton, cc.xy(2, 5)); JRadioButton selfButton = new JRadioButton(mLocalizer.msg("self", "I want to configure by myself")); panel.add(selfButton, cc.xy(2, 7)); ButtonGroup group = new ButtonGroup(); group.add(kdeButton); group.add(gnomeButton); group.add(selfButton); selfButton.setSelected(true); JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK)); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.setVisible(false); } }); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); buttonPanel.add(ok); panel.add(buttonPanel, cc.xy(2, 9)); UiUtilities.registerForClosing(new WindowClosingIf() { public void close() { dialog.setVisible(false); } public JRootPane getRootPane() { return dialog.getRootPane(); } }); dialog.getRootPane().setDefaultButton(ok); dialog.pack(); UiUtilities.centerAndShow(dialog); if (kdeButton.isSelected()) { mSettings.setApplication("kfmclient"); mSettings.setParameter("exec {content}"); } else if (gnomeButton.isSelected()) { mSettings.setApplication("gnome-open"); mSettings.setParameter("{content}"); } else { Plugin.getPluginManager().showSettings(mPlugin); return false; } return true; }
From source file:ffx.ui.ModelingPanel.java
/** * Create a string representing the modeling command to execute. * * @return the modeling command string./*from w ww . java 2 s. c o m*/ */ private String createCommandInput() { StringBuilder commandLineParams = new StringBuilder(activeCommand + " "); // Now append command line input to a TextArea, one option per line. // This TextArea gets dumped to an input file. commandTextArea.setText(""); int numparams = optionsTabbedPane.getTabCount(); for (int i = 0; i < numparams; i++) { // A few cases require that a newLine not be generated between // options. boolean newLine = true; // The optionString will collect the parameters for this Option, // then append them to the CommandTextArea. StringBuilder optionString = new StringBuilder(); JPanel optionPanel = (JPanel) optionsTabbedPane.getComponentAt(i); int numOptions = optionPanel.getComponentCount(); String title = optionsTabbedPane.getTitleAt(i); if (title.equalsIgnoreCase("Sequence")) { for (int k = 0; k < acidComboBox.getItemCount(); k++) { if (k != 0) { optionString.append("\n"); } String s = (String) acidComboBox.getItemAt(k); s = s.substring(s.indexOf(" "), s.length()).trim(); optionString.append(s); } // Need an extra newline for Nucleic if (activeCommand.equalsIgnoreCase("NUCLEIC")) { optionString.append("\n"); } } else { JPanel valuePanel = (JPanel) optionPanel.getComponent(numOptions - 1); int numValues = valuePanel.getComponentCount(); for (int j = 0; j < numValues; j++) { Component value = valuePanel.getComponent(j); if (value instanceof JCheckBox) { JCheckBox jcbox = (JCheckBox) value; if (jcbox.isSelected()) { optionString.append("-"); optionString.append(jcbox.getName()); optionString.append(" "); optionString.append(jcbox.getText()); } } else if (value instanceof JTextField) { JTextField jtfield = (JTextField) value; optionString.append("-"); optionString.append(jtfield.getName()); optionString.append(" "); optionString.append(jtfield.getText()); } else if (value instanceof JComboBox) { JComboBox jcb = (JComboBox) value; Object object = jcb.getSelectedItem(); if (object instanceof FFXSystem) { FFXSystem system = (FFXSystem) object; File file = system.getFile(); if (file != null) { String absolutePath = file.getAbsolutePath(); if (absolutePath.endsWith("xyz")) { absolutePath = absolutePath + "_1"; } optionString.append(absolutePath); } } } else if (value instanceof JRadioButton) { JRadioButton jrbutton = (JRadioButton) value; if (jrbutton.isSelected()) { if (!jrbutton.getText().equalsIgnoreCase("NONE")) { optionString.append("-"); optionString.append(jrbutton.getName()); optionString.append(" "); optionString.append(jrbutton.getText()); } if (title.equalsIgnoreCase("C-CAP")) { optionString.append("\n"); } } } } // Handle Conditional Options if (optionPanel.getComponentCount() == 3) { valuePanel = (JPanel) optionPanel.getComponent(1); // JLabel conditionalLabel = (JLabel) // valuePanel.getComponent(0); JTextField jtf = (JTextField) valuePanel.getComponent(1); if (jtf.isEnabled()) { String conditionalInput = jtf.getText(); // Post-Process the Input into Atom Pairs String postProcess = jtf.getName(); if (postProcess != null && postProcess.equalsIgnoreCase("ATOMPAIRS")) { String tokens[] = conditionalInput.split(" +"); StringBuilder atomPairs = new StringBuilder(); int atomNumber = 0; for (String token : tokens) { atomPairs.append(token); if (atomNumber++ % 2 == 0) { atomPairs.append(" "); } else { atomPairs.append("\n"); } } conditionalInput = atomPairs.toString(); } // Append a newline to "enter" the option string. // Append "conditional" input. optionString.append("\n").append(conditionalInput); } } } if (optionString.length() > 0) { commandTextArea.append(optionString.toString()); if (newLine) { commandTextArea.append("\n"); } } } String commandInput = commandTextArea.getText(); if (commandInput != null && !commandInput.trim().equalsIgnoreCase("")) { commandLineParams.append(commandInput); } // The final token on the command line is the structure file name, except // for protein and nucleic. if (!activeCommand.equalsIgnoreCase("Protein") && !activeCommand.equalsIgnoreCase("Nucleic")) { File file = activeSystem.getFile(); if (file != null) { String name = file.getName(); commandLineParams.append(name); commandLineParams.append(" "); } else { return null; } } return commandLineParams.toString(); }