List of usage examples for javax.swing JOptionPane PLAIN_MESSAGE
int PLAIN_MESSAGE
To view the source code for javax.swing JOptionPane PLAIN_MESSAGE.
Click Source Link
From source file:de.weltraumschaf.minesweeper.control.FieldBoxButtonListener.java
/** * Determines if the games was won and shows a dialog in case of won game. * * @param field must not be {@code null} */// w ww . ja va 2s.co m private void checkForWon(final MineField field) { LOG.debug("Check if game was won."); Validate.notNull(field, "Field must not be null!"); if (LOG.isDebugEnabled()) { debugFieldSate(field); } if (field.getGame().hasWon()) { LOG.debug("Game won!"); field.getGame().stop(); JOptionPane.showMessageDialog(main, String.format("Game won!"), main.getTitle(), JOptionPane.PLAIN_MESSAGE); openFlaggedBoxes(field); } }
From source file:com.neurotec.samples.panels.EnrollFromScanner.java
private void startCapturing() { lblInfo.setText(""); if (FingersTools.getInstance().getClient().getFingerScanner() == null) { JOptionPane.showMessageDialog(this, "Please select scanner from the list.", "No scanner selected", JOptionPane.PLAIN_MESSAGE); return;//from w w w . ja v a 2s . co m } // Create a finger. NFinger finger = new NFinger(); // Set Manual capturing mode if automatic isn't selected. if (!cbAutomatic.isSelected()) { finger.setCaptureOptions(EnumSet.of(NBiometricCaptureOption.MANUAL)); } // Add finger to subject and finger view. subject = new NSubject(); subject.getFingers().add(finger); view.setFinger(finger); view.setShownImage(ShownImage.ORIGINAL); // Begin capturing. NBiometricTask task = FingersTools.getInstance().getClient() .createTask(EnumSet.of(NBiometricOperation.CAPTURE, NBiometricOperation.CREATE_TEMPLATE), subject); FingersTools.getInstance().getClient().performTask(task, null, captureCompletionHandler); scanning = true; updateControls(); }
From source file:csh.vctt.launcher.Launcher.java
/** * Prompt the user to select their character from a dialog. * @return Unique id number of the selected character. *//* w w w. j a v a 2 s . c o m*/ private String getPlayerSelection() { String selectedId = "-1"; String outfitMembersJson = DataManager.execQuery(DataManager.M_OUTFITMEMBER_SELECT_QUERY); List<Player> outfitMembers = DataManager.getOutfitMembers(outfitMembersJson); Object[] outfitMembersArrObj = outfitMembers.toArray(); Player[] outfitMembersArr = new Player[outfitMembersArrObj.length]; for (int i = 0; i < outfitMembersArrObj.length; i++) { outfitMembersArr[i] = (Player) outfitMembersArrObj[i]; } JList<Player> memSelList = new JList<Player>(outfitMembersArr); memSelList.setVisibleRowCount(10); JScrollPane memScrollPane = new JScrollPane(memSelList); memScrollPane.setPreferredSize(new Dimension(200, 400)); int userAction = JOptionPane.showConfirmDialog(null, memScrollPane, "Select Character and Press Ok", JOptionPane.PLAIN_MESSAGE); Player selectedPlayer = null; if (userAction == JOptionPane.YES_OPTION) { selectedPlayer = memSelList.getSelectedValue(); } if (selectedPlayer != null) { selectedId = selectedPlayer.getId(); } return selectedId; }
From source file:net.pms.newgui.LanguageSelection.java
public void show() { if (PMS.isHeadless()) { // Can only get here during startup in headless mode, there's no way to trigger it from the GUI LOGGER.info(/*from w w w .ja va 2s . c o m*/ "No language is configured and the language selection dialog is unavailable in headless mode"); LOGGER.info("Defaulting to OS locale {}", Locale.getDefault().getDisplayName()); PMS.setLocale(Locale.getDefault()); } else { pane = new JOptionPane(buildComponent(), JOptionPane.PLAIN_MESSAGE, JOptionPane.NO_OPTION, null, new JButton[] { applyButton, selectButton }, selectButton); pane.setComponentOrientation(ComponentOrientation.getOrientation(locale)); dialog = pane.createDialog(parentComponent, PMS.NAME); dialog.setModalityType(ModalityType.APPLICATION_MODAL); dialog.setIconImage(LooksFrame.readImageIcon("icon-32.png").getImage()); setStrings(); dialog.pack(); dialog.setLocationRelativeTo(parentComponent); dialog.setVisible(true); dialog.dispose(); if (pane.getValue() == null) { aborted = true; } else if (!((String) pane.getValue()).equals(PMS.getConfiguration().getLanguageRawString())) { if (rebootOnChange) { int response = JOptionPane.showConfirmDialog(parentComponent, String.format(buildString("Dialog.Restart", true), PMS.NAME, PMS.NAME), buildString("Dialog.Confirm"), JOptionPane.YES_NO_CANCEL_OPTION); if (response != JOptionPane.CANCEL_OPTION) { PMS.getConfiguration().setLanguage((String) pane.getValue()); if (response == JOptionPane.YES_OPTION) { try { PMS.getConfiguration().save(); } catch (ConfigurationException e) { LOGGER.error("Error while saving configuration: {}", e.getMessage()); LOGGER.trace("", e); } ProcessUtil.reboot(); } } } else { PMS.getConfiguration().setLanguage((String) pane.getValue()); } } } }
From source file:flow.visibility.tapping.OpenDaylightHelper.java
public static void main(String ODPURL, String ODPAccount, String ODPPassword, String DPID, String Flow, String Priority, String Ingress, String Outgress, String Filter1, String Filter2, String Filter3, String Filter4, String Filter5, String Filter6) throws JSONException { //OpenDaylight Data //String ODPURL = "103.22.221.152:8080"; //String ODPAccount = "admin"; //String ODPPassword = "admin"; /**Sample post data (refer to ODP REST API) */ JSONObject postData = new JSONObject(); postData.put("installInHw", "true"); postData.put("name", Flow); postData.put("ingressPort", Ingress); postData.put("priority", Priority); postData.put("etherType", "0x800"); //postData.put("nwSrc", Filter1); if (!Filter1.equals("")) { postData.put("nwSrc", Filter1); }//from w ww .j a v a2 s. c om //postData.put("nwDst", Filter2); if (!Filter2.equals("")) { postData.put("nwDst", Filter2); } if (!Filter3.equals("")) { postData.put("protocol", Filter3); } if (!Filter4.equals("")) { postData.put("tpSrc", Filter4); } if (!Filter5.equals("")) { postData.put("tpDst", Filter5); } if (!Filter6.equals("")) { postData.put("vlanId", Filter6); } /** Make string for OpenFlow Action */ String Action = "OUTPUT=" + Outgress; postData.put("actions", new JSONArray().put(Action)); /** Select Node on which this flow should be installed */ JSONObject node = new JSONObject(); node.put("id", DPID); node.put("type", "OF"); postData.put("node", node); /** Actual flow installation */ boolean result = OpenDaylightHelper.installFlow(postData, ODPAccount, ODPPassword, ODPURL); /** The Result of the Flow Installation */ if (result) { System.out.println("Flow installed Successfully"); JOptionPane.showMessageDialog(null, "Flow installed Successfully.", "Successful Message", JOptionPane.PLAIN_MESSAGE); } else { System.err.println("Failed to install flow!"); JOptionPane.showMessageDialog(null, "Failed to install flow!", "Error Message", JOptionPane.ERROR_MESSAGE); } }
From source file:com.codedx.burp.security.InvalidCertificateDialogStrategy.java
@Override public CertificateAcceptance checkAcceptance(Certificate genericCert, CertificateException certError) { if (genericCert instanceof X509Certificate && defaultHostVerifier instanceof DefaultHostnameVerifier) { X509Certificate cert = (X509Certificate) genericCert; DefaultHostnameVerifier verifier = (DefaultHostnameVerifier) defaultHostVerifier; JPanel message = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 2;/* ww w. j a va 2 s . c o m*/ gbc.insets = new Insets(0, 0, 10, 0); gbc.anchor = GridBagConstraints.WEST; message.add( new JLabel("Unable to establish a secure connection because the certificate is not trusted"), gbc); gbc = new GridBagConstraints(); gbc.gridy = 2; gbc.insets = new Insets(2, 0, 2, 0); gbc.anchor = GridBagConstraints.WEST; JLabel issuer = new JLabel("Issuer: "); Font defaultFont = issuer.getFont(); Font bold = new Font(defaultFont.getName(), Font.BOLD, defaultFont.getSize()); issuer.setFont(bold); message.add(issuer, gbc); gbc.gridx = 1; message.add(new JLabel(cert.getIssuerDN().toString()), gbc); try { JLabel fingerprint = new JLabel("Thumbprint: "); fingerprint.setFont(bold); gbc.gridx = 0; gbc.gridy += 1; message.add(fingerprint, gbc); gbc.gridx = 1; message.add(new JLabel(toHexString(getSHA1(cert.getEncoded()), " ")), gbc); } catch (CertificateEncodingException e) { // this shouldn't actually ever happen } try { verifier.verify(host, cert); } catch (SSLException e) { String cn = getCN(cert); JLabel mismatch = new JLabel("Host Mismatch: "); mismatch.setFont(bold); gbc.gridx = 0; gbc.gridy += 1; message.add(mismatch, gbc); String msg; if (cn != null) { msg = String.format("Expected '%s', but the certificate is for '%s'.", host, cn); } else { msg = e.getMessage(); } gbc.gridx = 1; message.add(new JLabel(msg), gbc); } // Open the dialog, and return its result int choice = JOptionPane.showOptionDialog(burpExtender.getUiComponent(), message, dialogTitle, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, dialogButtons, null); switch (choice) { case (0): return CertificateAcceptance.REJECT; case (1): return CertificateAcceptance.ACCEPT_TEMPORARILY; case (2): return CertificateAcceptance.ACCEPT_PERMANENTLY; } } return CertificateAcceptance.REJECT; }
From source file:com.frostwire.gui.library.LibraryUtils.java
public static void createNewPlaylist(final List<? extends AbstractLibraryTableDataLine<?>> lines) { String playlistName = (String) JOptionPane.showInputDialog(GUIMediator.getAppFrame(), I18n.tr("Playlist name"), I18n.tr("Playlist name"), JOptionPane.PLAIN_MESSAGE, null, null, calculateName(lines));//from w ww .j ava 2s . com if (playlistName != null && playlistName.length() > 0) { final Playlist playlist = LibraryMediator.getLibrary().newPlaylist(playlistName, playlistName); playlist.save(); LibraryMediator.instance().getLibraryPlaylists().addPlaylist(playlist); LibraryMediator.instance().getLibraryPlaylists().markBeginImport(playlist); Thread t = new Thread(new Runnable() { public void run() { addToPlaylist(playlist, lines); playlist.save(); asyncAddToPlaylistFinalizer(playlist); } }, "createNewPlaylist"); t.setDaemon(true); t.start(); } }
From source file:JuliaSet3.java
public void printToService(PrintService service, PrintRequestAttributeSet printAttributes) { // Wrap ourselves in the PrintableComponent class defined by JuliaSet2. String title = "Julia set for c={" + cx + "," + cy + "}"; Printable printable = new PrintableComponent(this, title); // Now create a Doc that encapsulate the Printable object and its type DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE; Doc doc = new SimpleDoc(printable, flavor, null); // Java 1.1 uses PrintJob. // Java 1.2 uses PrinterJob. // Java 1.4 uses DocPrintJob. Create one from the service DocPrintJob job = service.createPrintJob(); // Set up a dialog box to monitor printing status final JOptionPane pane = new JOptionPane("Printing...", JOptionPane.PLAIN_MESSAGE); JDialog dialog = pane.createDialog(this, "Print Status"); // This listener object updates the dialog as the status changes job.addPrintJobListener(new PrintJobAdapter() { public void printJobCompleted(PrintJobEvent e) { pane.setMessage("Printing complete."); }/* ww w. java2s .c o m*/ public void printDataTransferCompleted(PrintJobEvent e) { pane.setMessage("Document transfered to printer."); } public void printJobRequiresAttention(PrintJobEvent e) { pane.setMessage("Check printer: out of paper?"); } public void printJobFailed(PrintJobEvent e) { pane.setMessage("Print job failed"); } }); // Show the dialog, non-modal. dialog.setModal(false); dialog.show(); // Now print the Doc to the DocPrintJob try { job.print(doc, printAttributes); } catch (PrintException e) { // Display any errors to the dialog box pane.setMessage(e.toString()); } }
From source file:hr.fer.zemris.vhdllab.platform.ui.command.DevFloodWithCompliationRequestsCommand.java
private void showResults(List<String> results) { logger.info(results);//from w w w .ja v a2s . co m JList list = new JList(results.toArray()); JOptionPane.showOptionDialog(null, new JScrollPane(list), "Results", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null); }
From source file:com.microsoftopentechnologies.intellij.helpers.AndroidStudioHelper.java
public static void newActivityTemplateManager() throws IOException, InterruptedException { String[] cmd = null;/*from ww w . j a v a 2s . c o m*/ String templatePath = URLDecoder .decode(ApplicationComponent.class.getResource("").getPath().replace("file:/", ""), "UTF-8"); templatePath = templatePath.replace("/", File.separator); templatePath = templatePath.substring(0, templatePath.indexOf(File.separator + "lib")); templatePath = templatePath + File.separator + "plugins" + File.separator + "android" + File.separator; templatePath = templatePath + "lib" + File.separator + "templates" + File.separator + "activities" + File.separator; String[] env = null; if (!new File(templatePath + mobileServicesTemplateName).exists()) { String tmpdir = getTempLocation(); BufferedInputStream bufferedInputStream = new BufferedInputStream( ServiceCodeReferenceHelper.getTemplateResource("ActivityTemplate.zip")); unZip(bufferedInputStream, tmpdir); if (System.getProperty("os.name").toLowerCase().startsWith("windows")) { try { copyFolder(new File(tmpdir + mobileServicesTemplateName), new File(templatePath + mobileServicesTemplateName)); copyFolder(new File(tmpdir + officeTemplateName), new File(templatePath + officeTemplateName)); } catch (IOException ex) { PrintWriter printWriter = new PrintWriter(tmpdir + "\\script.bat"); printWriter.println("@echo off"); printWriter.println("md \"" + templatePath + mobileServicesTemplateName + "\""); printWriter.println("md \"" + templatePath + officeTemplateName + "\""); printWriter.println("xcopy \"" + tmpdir + mobileServicesTemplateName + "\" \"" + templatePath + mobileServicesTemplateName + "\" /s /i /Y"); printWriter.println("xcopy \"" + tmpdir + officeTemplateName + "\" \"" + templatePath + officeTemplateName + "\" /s /i /Y"); printWriter.flush(); printWriter.close(); String[] tmpcmd = { tmpdir + "\\elevate.exe", "script.bat", "1" }; cmd = tmpcmd; ArrayList<String> tempenvlist = new ArrayList<String>(); for (String envval : System.getenv().keySet()) tempenvlist.add(String.format("%s=%s", envval, System.getenv().get(envval))); tempenvlist.add("PRECOMPILE_STREAMLINE_FILES=1"); env = new String[tempenvlist.size()]; tempenvlist.toArray(env); Runtime rt = Runtime.getRuntime(); Process proc = rt.exec(cmd, env, new File(tmpdir)); proc.waitFor(); //wait for elevate command to finish Thread.sleep(3000); if (!new File(templatePath + mobileServicesTemplateName).exists()) UIHelper.showException( "Error copying template files. Please refer to documentation to copy manually.", new Exception()); } } else { if (System.getProperty("os.name").toLowerCase().startsWith("mac")) { String[] strings = { "osascript", // "-e", // "do shell script \"mkdir -p \\\"/" + templatePath + mobileServicesTemplateName + "\\\"\"", // "-e", // "do shell script \"mkdir -p \\\"/" + templatePath + officeTemplateName + "\\\"\"", "-e", "do shell script \"cp -Rp \\\"" + tmpdir + mobileServicesTemplateName + "\\\" \\\"/" + templatePath + "\\\"\"", "-e", "do shell script \"cp -Rp \\\"" + tmpdir + officeTemplateName + "\\\" \\\"/" + templatePath + "\\\"\"" }; exec(strings, tmpdir); } else { try { copyFolder(new File(tmpdir + mobileServicesTemplateName), new File(templatePath + mobileServicesTemplateName)); copyFolder(new File(tmpdir + officeTemplateName), new File(templatePath + officeTemplateName)); } catch (IOException ex) { JPasswordField pf = new JPasswordField(); int okCxl = JOptionPane.showConfirmDialog(null, pf, "To copy Microsoft Services templates, the plugin needs your password:", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (okCxl == JOptionPane.OK_OPTION) { String password = new String(pf.getPassword()); exec(new String[] { "echo", password, "|", "sudo", "-S", "cp", "-Rp", tmpdir + mobileServicesTemplateName, templatePath + mobileServicesTemplateName }, tmpdir); exec(new String[] { "echo", password, "|", "sudo", "-S", "cp", "-Rp", tmpdir + officeTemplateName, templatePath + officeTemplateName }, tmpdir); } } } } } }