List of usage examples for javax.swing JOptionPane showInputDialog
public static String showInputDialog(Component parentComponent, Object message, String title, int messageType) throws HeadlessException
parentComponent
with the dialog having the title title
and message type messageType
. From source file:org.sikuli.ide.SikuliIDE.java
private static String[] collectOptions(String type, String[] args) { List<String> resArgs = new ArrayList<String>(); if (args != null) { resArgs.addAll(Arrays.asList(args)); }//from w w w . j av a 2s . co m String msg = "----------------------- You might set some options -----------------------"; msg += "\n\n"; msg += "-r name --- Run script name: foo[.sikuli] or foo.skl (no IDE window)"; msg += "\n"; msg += "-u [file] --- Write user log messages to file (default: <WorkingFolder>/UserLog.txt )"; msg += "\n"; msg += "-f [file] --- Write Sikuli log messages to file (default: <WorkingFolder>/SikuliLog.txt)"; msg += "\n"; msg += "-d n --- Set a higher level n for Sikuli's debug messages (default: 0)"; msg += "\n"; msg += "-- more All space delimited entries after -- go to sys.argv"; msg += "\n \"<some text>\" makes one parameter (may contain intermediate blanks)"; msg += "\n\n"; msg += "-------------------------------------------------------------------------"; msg += "\n"; msg += "-d Special debugging option in case of mysterious errors:"; msg += "\n"; msg += " Debug level is set to 3 and debug output goes to <WorkingFolder>/SikuliLog.txt"; msg += "\n"; msg += " Content might be used to ask questions or report bugs"; msg += "\n"; msg += "-------------------------------------------------------------------------"; msg += "\n"; msg += " Just click OK to start IDE with no options - defaults will be used"; String ret = JOptionPane.showInputDialog(null, msg, "SikuliX: collect runtime options", JOptionPane.QUESTION_MESSAGE); if (ret == null) { return null; } log(3, "collectOptions: returned [" + ret + "]"); if (!ret.isEmpty()) { System.setProperty("sikuli.SIKULI_COMMAND", ret); resArgs.addAll(Arrays.asList(ret.split(" +"))); } return resArgs.toArray(new String[0]); }
From source file:org.tinymediamanager.ui.moviesets.actions.MovieSetAddAction.java
@Override public void actionPerformed(ActionEvent e) { String name = JOptionPane.showInputDialog(null, BUNDLE.getString("movieset.title"), "", //$NON-NLS-1$ JOptionPane.QUESTION_MESSAGE); if (StringUtils.isNotEmpty(name)) { MovieSet movieSet = new MovieSet(name); movieSet.saveToDb();/* w ww. java2 s. c o m*/ MovieList.getInstance().addMovieSet(movieSet); } }
From source file:org.wso2.appserver.sample.flickr.client.FlickrServiceFrame.java
public void getAPIKEY() { while (true) { key = JOptionPane.showInputDialog(this, "Please enter a valid API KEY for flickr", "Enter API KEY", JOptionPane.INFORMATION_MESSAGE); if (key == null) { System.exit(0);//w ww .java 2s . c o m } else if ("".equals(key.trim())) { JOptionPane.showMessageDialog(this, "The API KEY cannot be empty"); } else { break; } } this.setSharedSecret(sharedSecret); }
From source file:org.wso2.appserver.sample.flickr.client.FlickrServiceFrame.java
public boolean getSharedSecret() { while (true) { sharedSecret = JOptionPane.showInputDialog(this, "Please enter the shared secret corresponding to your API KEY", "Enter Shared Secret", JOptionPane.INFORMATION_MESSAGE); if (sharedSecret == null) { return false; } else if ("".equals(sharedSecret.trim())) { JOptionPane.showMessageDialog(this, "The Shared Secret cannot be empty"); } else {//from w ww . ja v a 2 s . c om break; } } this.setKey(key); return true; }
From source file:put.semantic.fcanew.ui.MainWindow.java
private void continueStart() { final List<Attribute> forced = getAttributes(2); if (forced.isEmpty()) { forced.addAll(getAttributes(1)); }//w w w . j ava2s. c om logger.trace("START"); for (Attribute a : getUsedAttributes()) { logger.trace("ATTR: {}", a); } context = new PartialContext(new SimpleSetOfAttributes(getUsedAttributes()), kb); context.addProgressListener(progressListener); context.updateContext(); contextTable.setRowSorter(new TableRowSorter<>()); contextTable.setModel(new ContextDataModel(context)); contextTable.setDefaultRenderer(Object.class, new PODCellRenderer(kb.getReasoner())); Enumeration<TableColumn> e = contextTable.getColumnModel().getColumns(); JComboBox comboBox = new JComboBox(new Object[] { "+", "-", " " }); while (e.hasMoreElements()) { TableColumn col = e.nextElement(); col.setHeaderRenderer(new VerticalTableHeaderCellRenderer()); col.setCellEditor(new DefaultCellEditor(comboBox)); if (col.getModelIndex() >= 1) { col.setPreferredWidth(20); } } List<? extends FeatureCalculator> calculators = availableCalculatorsModel.getChecked(); for (FeatureCalculator calc : calculators) { if (calc instanceof EndpointCalculator) { ((EndpointCalculator) calc).setMappings(mappingsPanel1.getMappings()); } } Classifier classifier = (Classifier) classifierToUse.getSelectedItem(); classifier.setRejectedWeight((Double) rejectedWeight.getValue()); mlExpert = new MLExpert(classifier, (Integer) credibilityTreshold.getValue(), calculators, getIgnoreTreshold(), context, getAutoAcceptTreshold()); mlExpert.addEventListener(new MLExpertEventListener() { @Override public void implicationAccepted(ImplicationDescription i, boolean autoDecision) { logger.trace("ACCEPT"); setButtonsEnabled(false); ((ConfusionMatrix) confusionMatrix.getModel()).add(i.getSuggestion(), Expert.Decision.ACCEPT); registerImplication(i.getImplication(), i.getClassificationOutcome(), Expert.Decision.ACCEPT); } @Override public void implicationRejected(ImplicationDescription i, boolean autoDecision) { logger.trace("REJECT"); setButtonsEnabled(false); ((ConfusionMatrix) confusionMatrix.getModel()).add(i.getSuggestion(), Expert.Decision.REJECT); registerImplication(i.getImplication(), i.getClassificationOutcome(), Expert.Decision.REJECT); } private TableModel getFeaturesTableModel(Map<String, Double> features) { DefaultTableModel model = new DefaultTableModel(new String[] { "feature", "value" }, 0); for (Map.Entry<String, Double> f : features.entrySet()) { model.addRow(new Object[] { f.getKey(), f.getValue() }); } return model; } @Override public void ask(ImplicationDescription i, String justification) { logger.trace("ASK: {}", i.getImplication()); highlightButton(i.getSuggestion()); ((ContextDataModel) contextTable.getModel()).setCurrentImplication(i.getImplication()); justificationText.setText(justification); implicationText.setText(String.format("<html>%s</html>", i.getImplication().toString())); { Map<String, String> desc = i.getImplication().describe(kb); String s = "<html><table border=\"1\">"; s += "<tr><th>Attribute</th><th>Label</th></tr>"; for (Map.Entry<String, String> e : desc.entrySet()) { s += String.format("<tr><td>%s</td><td><pre>%s</pre></td></tr>", e.getKey(), e.getValue()); } s += "</table></html>"; implicationText.setToolTipText(s); } setButtonsEnabled(true); featuresTable.setModel(getFeaturesTableModel(i.getFeatures())); } }); learningExamplesTable.setModel(classifier.getExamplesTableModel()); fca = new FCA(); fca.setContext(context); fca.setExpert(mlExpert); new SwingWorker() { @Override protected Object doInBackground() throws Exception { fca.reset(forced); fca.run(); return null; } @Override protected void done() { try { get(); logger.trace("FINISHED"); if (script != null) { String name = JOptionPane.showInputDialog(MainWindow.this, "Jeeli chcesz otrzyma punkty z TSiSS, podaj swoje imi, nazwisko i nr indeksu", "TSiSS", JOptionPane.QUESTION_MESSAGE); if (name != null) { logger.trace("NAME: {}", name); } script.submitLog(new File("fca.log")); } implicationText.setText("Bye-bye"); } catch (InterruptedException | ExecutionException ex) { implicationText.setText(ex.getLocalizedMessage()); ex.printStackTrace(); } } }.execute(); }