List of usage examples for javax.swing JOptionPane showInputDialog
@SuppressWarnings("deprecation") public static Object showInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue) throws HeadlessException
From source file:processing.app.Editor.java
public boolean serialPrompt() { int count = serialMenu.getItemCount(); Object[] names = new Object[count]; for (int i = 0; i < count; i++) { names[i] = ((JCheckBoxMenuItem) serialMenu.getItem(i)).getText(); }//w w w . j a va 2 s. c om String result = (String) JOptionPane.showInputDialog(this, I18n.format(_("Serial port {0} not found.\n" + "Retry the upload with another serial port?"), PreferencesData.get("serial.port")), "Serial port not found", JOptionPane.PLAIN_MESSAGE, null, names, 0); if (result == null) return false; selectSerialPort(result); base.onBoardOrPortChange(); return true; }
From source file:pt.lsts.neptus.comm.iridium.IridiumManager.java
public void selectMessenger(Component parent) { Object op = JOptionPane.showInputDialog(parent, "Select Iridium provider", "Iridium Provider", JOptionPane.QUESTION_MESSAGE, ImageUtils.createImageIcon("images/satellite.png"), IridiumMessengerEnum.values(), GeneralPreferences.iridiumMessenger); if (op != null) { GeneralPreferences.iridiumMessenger = (IridiumMessengerEnum) op; GeneralPreferences.saveProperties(); }//from w w w .j a va 2s .c om }
From source file:pt.lsts.neptus.plugins.sunfish.IridiumComms.java
private void commandPlanExecution() { Collection<String> planNames = getConsole().getMission().getIndividualPlansList().keySet(); if (planNames.isEmpty()) return;//w w w . j a v a 2s .co m String selectedPlan = planNames.iterator().next(); if (getConsole().getPlan() != null) { selectedPlan = getConsole().getPlan().getId(); } final Object selection = JOptionPane.showInputDialog(getConsole(), "Select plan to be commanded via Iridium", "Start plan", JOptionPane.QUESTION_MESSAGE, null, planNames.toArray(), selectedPlan); if (selection == null) return; Thread send = new Thread("Send plan via iridium") { @Override public void run() { String selectedPlan = selection.toString(); PlanType toSend = getConsole().getMission().getIndividualPlansList().get(selectedPlan); IMCMessage msg = toSend.asIMCPlan(); PlanControl pc = new PlanControl(); pc.setArg(msg); pc.setOp(OP.START); pc.setType(TYPE.REQUEST); pc.setPlanId(selectedPlan); sendViaIridium(getMainVehicleId(), pc); }; }; send.setDaemon(true); send.start(); }
From source file:put.semantic.fcanew.ui.MainWindow.java
private void downloadSomethingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadSomethingActionPerformed final Implication impl = mlExpert.getCurrentImplication(); new SwingWorker<List<String>, Object>() { @Override// w ww . ja v a 2s .c o m protected List<String> doInBackground() throws Exception { List<String> result = downloader.select(0, toArray(impl.getPremises().iterator())); removeKnown(result); return result; } @Override protected void done() { try { List<String> uris = get(); if (uris.isEmpty()) { JOptionPane.showMessageDialog(MainWindow.this, "There are no objects fulifying premises and not available in considered context"); return; } Object result = JOptionPane.showInputDialog(MainWindow.this, "Select URI", "Downloaded something", JOptionPane.PLAIN_MESSAGE, null, uris.toArray(new String[0]), uris.get(0)); addNew((String) result); } catch (InterruptedException | ExecutionException ex) { //should never happen ex.printStackTrace(); } } }.execute(); }
From source file:rmeteorj.GUI.GUI.java
/** * Open file for detection or analysis/*from w ww .ja v a 2 s . c o m*/ */ public static void openFile() { JFileChooser fc = new JFileChooser(); fc.setDialogTitle("Open file"); fc.setMultiSelectionEnabled(true); int response = fc.showOpenDialog(MainWindow.getInstance()); if (response == JFileChooser.APPROVE_OPTION) { String[] options = ArrayUtils.addAll(ModuleManager.getManager().getEnabledDetectModulesNames(), ModuleManager.getManager().getEnabledAnalyzeModulesNames()); if (options.length == 0) { JOptionPane.showMessageDialog(MainWindow.getInstance(), "Enable detect or analyze module first."); return; } options[options.length] = "Cancel"; String moduleName = (String) JOptionPane.showInputDialog(MainWindow.getInstance(), "Send opened files to: ", "Open file", JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (!moduleName.equals("Cancel")) { ModuleManager.getManager().openFilesAnalyzeOrDetect(fc.getSelectedFiles(), moduleName); } } }
From source file:ru.apertum.qsystem.client.forms.FReception.java
private void tablePreRegMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablePreRegMouseClicked final QService service = (QService) comboBoxServices.getSelectedItem(); if (evt.getClickCount() > 1 && tablePreReg.getSelectedRow() >= 0 && service != null && service.isLeaf()) { final FirstPreCell fc = (FirstPreCell) tablePreReg.getValueAt(tablePreReg.getSelectedRow(), 0); final GregorianCalendar gc = new GregorianCalendar(); gc.add(GregorianCalendar.HOUR_OF_DAY, 1); if (fc.getDate().before(gc.getTime())) { return; }//from w w w .j a v a 2s . c o m if (fc.getAcust().getAdvanceTime() == null) { if (0 == JOptionPane.showConfirmDialog(this, getLocaleMessage("make.pre.reg ") + fc + "?", getLocaleMessage("pre.reg"), JOptionPane.YES_NO_OPTION)) { String inputData = null; if (service.getInput_required()) { inputData = (String) JOptionPane.showInputDialog(this, service.getInput_caption(), "***", 3, null, null, ""); //NOI18N if (inputData == null) { return; } } String comments = (String) JOptionPane.showInputDialog(this, getLocaleMessage("admin.comments"), "***", 3, null, null, ""); //NOI18N if (inputData == null) { inputData = ""; //NOI18N } final QAdvanceCustomer res; try { res = NetCommander.standInServiceAdvance(netProperty, service.getId(), fc.getDate(), -1, inputData, comments); } catch (Exception ex) { throw new ClientException(getLocaleMessage("admin.send_cmd_adv.err") + " " + ex); //NOI18N } if (res == null) { return; } // if (checkBoxPrintAdvTicket.isSelected()) { new Thread(() -> { FWelcome.printTicketAdvance(res, ((QService) treeServices.getModel().getRoot()) .getTextToLocale(QService.Field.NAME)); }).start(); } preRegChange(true); JOptionPane.showMessageDialog(this, getLocaleMessage("admin.client_adv_dialog.msg_1") + " \"" + service.getName() + "\". " + getLocaleMessage("admin.client_adv_dialog.msg_2") + " \"" + res.getId() + "\".", getLocaleMessage("admin.client_adv_dialog.title"), JOptionPane.INFORMATION_MESSAGE); } } else { if (0 == JOptionPane.showConfirmDialog(this, getLocaleMessage("clint.came") + fc + "?", getLocaleMessage("pre.reg.2"), JOptionPane.YES_NO_OPTION)) { final RpcStandInService res = NetCommander.standAndCheckAdvance(netProperty, fc.getAcust().getId()); if (res != null) { if (res.getMethod() == null) {// ?. ? ? ? ? QLog.l().logger().info(getLocaleMessage("print.ticket")); new Thread(() -> { FWelcome.printTicket(res.getResult(), ((QService) treeServices.getModel().getRoot()).getName()); }).start(); preRegChange(true); JOptionPane.showMessageDialog(this, getLocaleMessage("admin.client_adv_dialog.msg_3"), getLocaleMessage("admin.client_adv_dialog.title"), JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(this, res.getMethod(), getLocaleMessage("admin.client_adv_dialog.title"), JOptionPane.ERROR_MESSAGE); } } } } } }
From source file:ru.apertum.qsystem.client.forms.FReception.java
@Action public void setInLine() { final QService service = (QService) treeServices.getLastSelectedPathComponent(); if (service != null && service.isLeaf()) { if (service.getPreInfoHtml() != null && !service.getPreInfoHtml().isEmpty()) { JOptionPane.showMessageDialog(this, service.getPreInfoHtml(), "!!!", JOptionPane.INFORMATION_MESSAGE); //NOI18N }//from w w w. j a v a 2 s .com //? ? , ? String inputData = null; if (service.getInput_required()) { inputData = (String) JOptionPane.showInputDialog(this, service.getInput_caption().replaceAll("<[^>]*>", ""), "***", 3, null, null, ""); //NOI18N if (inputData == null || inputData.isEmpty()) { return; } } final QCustomer customer; try { customer = NetCommander.standInService(netProperty, service.getId(), "1", 1, inputData); //NOI18N } catch (Exception ex) { throw new ClientException(getLocaleMessage("admin.print_ticket_error") + " " + ex); } FWelcome.printTicket(customer, ((QService) treeServices.getModel().getRoot()).getName()); String pref = customer.getPrefix(); pref = "".equals(pref) ? "" : pref + "-"; JOptionPane.showMessageDialog(this, getLocaleMessage("admin.print_ticket.title") + " \"" + service.getName() + "\". " + getLocaleMessage("admin.print_ticket.title_1") + " \"" + pref + customer.getNumber() + "\".", getLocaleMessage("admin.print_ticket.caption"), JOptionPane.INFORMATION_MESSAGE); } }
From source file:ru.apertum.qsystem.client.forms.FReception.java
@Action public void setPriority() { final QCustomer2 cus = (QCustomer2) listLine.getSelectedValue(); if (cus != null) { final String name = (String) JOptionPane.showInputDialog(this, getLocaleMessage("admin.action.change_priority.get.message"), //NOI18N getLocaleMessage("admin.action.change_priority.get.title"), //NOI18N JOptionPane.QUESTION_MESSAGE, null, Uses.get_PRIORITYS_WORD().values().toArray(), Uses.get_PRIORITYS_WORD().values().toArray()[1]); //? , //from ww w . ja va 2 s. co m if (name != null) { for (int i = 0; i < Uses.get_PRIORITYS_WORD().size(); i++) { if (name.equals(Uses.get_PRIORITYS_WORD().get(i))) { JOptionPane.showMessageDialog(this, NetCommander.setCustomerPriority(netProperty, i, cus.customer.getFullNumber()), getLocaleMessage("admin.action.change_priority.title"), JOptionPane.INFORMATION_MESSAGE); refreshLines(); } } } } }
From source file:ru.apertum.qsystem.client.forms.FReception.java
@Action public void setAnyPriority() { final String num = (String) JOptionPane.showInputDialog(this, getLocaleMessage("admin.action.change_priority.num.message"), getLocaleMessage("admin.action.change_priority.num.title"), 3, null, null, ""); if (num != null) { final String name = (String) JOptionPane.showInputDialog(this, getLocaleMessage("admin.action.change_priority.get.message"), getLocaleMessage("admin.action.change_priority.get.title"), JOptionPane.QUESTION_MESSAGE, null, Uses.get_PRIORITYS_WORD().values().toArray(), Uses.get_PRIORITYS_WORD().values().toArray()[1]); //? , /*from w w w. ja v a 2 s.c om*/ if (name != null) { for (int i = 0; i < Uses.get_PRIORITYS_WORD().size(); i++) { if (name.equals(Uses.get_PRIORITYS_WORD().get(i))) { JOptionPane.showMessageDialog(this, NetCommander.setCustomerPriority(netProperty, i, num), getLocaleMessage("admin.action.change_priority.title"), JOptionPane.INFORMATION_MESSAGE); } } } } }
From source file:ru.apertum.qsystem.client.forms.FReception.java
@Action public void checkAnyTicket() { final String num = (String) JOptionPane.showInputDialog(this, getLocaleMessage("admin.action.change_priority.num.message"), getLocaleMessage("admin.action.change_priority.num.title"), 3, null, null, ""); if (num != null) { JOptionPane.showMessageDialog(this, NetCommander.checkCustomerNumber(netProperty, num), getLocaleMessage("admin.action.change_priority.num.title"), JOptionPane.INFORMATION_MESSAGE); }/*from ww w .ja v a2 s . c o m*/ }