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:net.sf.jabref.gui.preftabs.PreviewPrefsTab.java
public PreviewPrefsTab(JabRefPreferences prefs) { this.prefs = prefs; GridBagLayout layout = new GridBagLayout(); firstPanel.setLayout(layout);/* w w w . j ava 2 s.c o m*/ secondPanel.setLayout(layout); setLayout(layout); JLabel lab = new JLabel(Localization.lang("Preview") + " 1"); GridBagConstraints layoutConstraints = new GridBagConstraints(); layoutConstraints.anchor = GridBagConstraints.WEST; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.fill = GridBagConstraints.BOTH; layoutConstraints.weightx = 1; layoutConstraints.weighty = 0; layoutConstraints.insets = new Insets(2, 2, 2, 2); layout.setConstraints(lab, layoutConstraints); layoutConstraints.weighty = 1; layout.setConstraints(firstScrollPane, layoutConstraints); firstPanel.add(firstScrollPane); layoutConstraints.weighty = 0; layoutConstraints.gridwidth = 1; layoutConstraints.weightx = 0; layoutConstraints.fill = GridBagConstraints.NONE; layoutConstraints.anchor = GridBagConstraints.WEST; layout.setConstraints(testButton, layoutConstraints); firstPanel.add(testButton); layout.setConstraints(defaultButton, layoutConstraints); firstPanel.add(defaultButton); layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; JPanel newPan = new JPanel(); layoutConstraints.weightx = 1; layout.setConstraints(newPan, layoutConstraints); firstPanel.add(newPan); lab = new JLabel(Localization.lang("Preview") + " 2"); layout.setConstraints(lab, layoutConstraints); // p2.add(lab); layoutConstraints.weighty = 1; layoutConstraints.fill = GridBagConstraints.BOTH; layout.setConstraints(secondScrollPane, layoutConstraints); secondPanel.add(secondScrollPane); layoutConstraints.weighty = 0; layoutConstraints.weightx = 0; layoutConstraints.fill = GridBagConstraints.NONE; layoutConstraints.gridwidth = 1; layout.setConstraints(testButton2, layoutConstraints); secondPanel.add(testButton2); layout.setConstraints(defaultButton2, layoutConstraints); secondPanel.add(defaultButton2); layoutConstraints.gridwidth = 1; newPan = new JPanel(); layoutConstraints.weightx = 1; layout.setConstraints(newPan, layoutConstraints); secondPanel.add(newPan); layoutConstraints.weightx = 1; layoutConstraints.weighty = 0; layoutConstraints.fill = GridBagConstraints.BOTH; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; lab = new JLabel(Localization.lang("Preview") + " 1"); layout.setConstraints(lab, layoutConstraints); add(lab); layoutConstraints.weighty = 1; layout.setConstraints(firstPanel, layoutConstraints); add(firstPanel); lab = new JLabel(Localization.lang("Preview") + " 2"); layoutConstraints.weighty = 0; JSeparator sep = new JSeparator(SwingConstants.HORIZONTAL); layout.setConstraints(sep, layoutConstraints); add(sep); layout.setConstraints(lab, layoutConstraints); add(lab); layoutConstraints.weighty = 1; layout.setConstraints(secondPanel, layoutConstraints); add(secondPanel); layoutConstraints.weighty = 0; defaultButton.addActionListener(e -> { String tmp = layout1.getText().replace("\n", "__NEWLINE__"); PreviewPrefsTab.this.prefs.remove(JabRefPreferences.PREVIEW_0); layout1.setText( PreviewPrefsTab.this.prefs.get(JabRefPreferences.PREVIEW_0).replace("__NEWLINE__", "\n")); PreviewPrefsTab.this.prefs.put(JabRefPreferences.PREVIEW_0, tmp); }); defaultButton2.addActionListener(e -> { String tmp = layout2.getText().replace("\n", "__NEWLINE__"); PreviewPrefsTab.this.prefs.remove(JabRefPreferences.PREVIEW_1); layout2.setText( PreviewPrefsTab.this.prefs.get(JabRefPreferences.PREVIEW_1).replace("__NEWLINE__", "\n")); PreviewPrefsTab.this.prefs.put(JabRefPreferences.PREVIEW_1, tmp); }); testButton.addActionListener(e -> { PreviewPrefsTab.getTestEntry(); try { PreviewPanel testPanel = new PreviewPanel(null, PreviewPrefsTab.entry, null, layout1.getText()); testPanel.setPreferredSize(new Dimension(800, 350)); JOptionPane.showMessageDialog(null, testPanel, Localization.lang("Preview"), JOptionPane.PLAIN_MESSAGE); } catch (StringIndexOutOfBoundsException ex) { LOGGER.warn("Parsing error.", ex); JOptionPane.showMessageDialog(null, Localization.lang("Parsing error") + ": " + Localization.lang("illegal backslash expression") + ".\n" + ex.getMessage(), Localization.lang("Parsing error"), JOptionPane.ERROR_MESSAGE); } }); testButton2.addActionListener(e -> { PreviewPrefsTab.getTestEntry(); try { PreviewPanel testPanel = new PreviewPanel(null, PreviewPrefsTab.entry, null, layout2.getText()); testPanel.setPreferredSize(new Dimension(800, 350)); JOptionPane.showMessageDialog(null, new JScrollPane(testPanel), Localization.lang("Preview"), JOptionPane.PLAIN_MESSAGE); } catch (StringIndexOutOfBoundsException ex) { LOGGER.warn("Parsing error.", ex); JOptionPane.showMessageDialog(null, Localization.lang("Parsing error") + ": " + Localization.lang("illegal backslash expression") + ".\n" + ex.getMessage(), Localization.lang("Parsing error"), JOptionPane.ERROR_MESSAGE); } }); }
From source file:com.jostrobin.battleships.view.frames.GameFrame.java
public void showDestroyedDialog() { JOptionPane.showMessageDialog(this, "You have been destroyed", "Destroyed", JOptionPane.PLAIN_MESSAGE); }
From source file:com.jostrobin.battleships.view.frames.GameFrame.java
public void showDestroyedDialog(String username) { JOptionPane.showMessageDialog(this, username + " has been destroyed", "Destroyed", JOptionPane.PLAIN_MESSAGE); }
From source file:lu.fisch.moenagade.model.Project.java
public BloxsClass renameEntity(Entity entity) { String name = entity.getName(); boolean result; do {//from w ww.ja v a2 s. co m name = (String) JOptionPane.showInputDialog(frame, "Please enter the entitie's name.", "Rename entity", JOptionPane.PLAIN_MESSAGE, null, null, name); if (name == null) return null; result = true; // check if name is OK Matcher matcher = Pattern.compile("^[a-zA-Z_$][a-zA-Z_$0-9]*$").matcher(name); boolean found = matcher.find(); if (!found) { result = false; JOptionPane.showMessageDialog(frame, "Please chose a valid name.", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } // check if name is unique else if (entities.containsKey(name)) { result = false; JOptionPane.showMessageDialog(frame, "This name is not unique.", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } // check internal name else if (name.trim().equals("Entity")) { result = false; JOptionPane.showMessageDialog(frame, "The name \"Entity\" is already internaly\nused and thus not allowed!", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } else if (name.charAt(0) != name.toUpperCase().charAt(0)) { result = false; JOptionPane.showMessageDialog(frame, "The name should start with a capital letter.", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } else { // send refresh refresh(new Change(null, -1, "rename.entity", entity.getName(), name)); // switch entities.remove(entity.getName()); entities.put(name, entity); // rename file (if present) File fFrom = new File(directoryName + System.getProperty("file.separator") + "bloxs" + System.getProperty("file.separator") + "entities" + System.getProperty("file.separator") + entity.getName() + ".bloxs"); File fTo = new File(directoryName + System.getProperty("file.separator") + "bloxs" + System.getProperty("file.separator") + "entities" + System.getProperty("file.separator") + name + ".bloxs"); if (fFrom.exists()) fFrom.renameTo(fTo); // do the rename entity.setName(name); return entity; } } while (!result); return null; }
From source file:org.jfree.demo.DrawStringDemo.java
/** * Displays a primitive font chooser dialog to allow the user to change the font. *///from w ww. j a v a2 s.c o m private void displayFontDialog() { final FontChooserPanel panel = new FontChooserPanel(this.drawStringPanel1.getFont()); final int result = JOptionPane.showConfirmDialog(this, panel, "Font Selection", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { this.drawStringPanel1.setFont(panel.getSelectedFont()); this.drawStringPanel2.setFont(panel.getSelectedFont()); } }
From source file:Listeners.MyActionListener.java
public void saveAction() { if (lista.getCod() == 0) { String s = (String) JOptionPane.showInputDialog(vista, "Ponle un nombre a tu lista", "Guardar lista", JOptionPane.PLAIN_MESSAGE, null, null, ""); //If a string was returned, say so. if ((s != null) && (s.length() > 0)) { lista.setDescripcion(s);/*from ww w .j a v a 2s .c o m*/ } } addRequest(); }
From source file:dbseer.gui.panel.DBSeerMiddlewarePanel.java
@Override public void actionPerformed(ActionEvent actionEvent) { try {//from ww w. ja v a 2s .c o m if (actionEvent.getSource() == startMonitoringButton) { id = idField.getText(); password = String.valueOf(passwordField.getPassword()); ip = ipField.getText(); port = Integer.parseInt(portField.getText()); // liveDatasetPath = DBSeerGUI.userSettings.getDBSeerRootPath() + File.separator + // DBSeerConstants.LIVE_DATASET_PATH; String date = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); currentDatasetPath = DBSeerGUI.userSettings.getDBSeerRootPath() + File.separator + DBSeerConstants.ROOT_DATASET_PATH + File.separator + date; final File newDatasetDirectory = new File(currentDatasetPath); // create new dataset directory FileUtils.forceMkdir(newDatasetDirectory); if (newDatasetDirectory == null || !newDatasetDirectory.isDirectory()) { JOptionPane.showMessageDialog(DBSeerGUI.mainFrame, String.format("We could not create the dataset directory: %s", currentDatasetPath), "Message", JOptionPane.PLAIN_MESSAGE); return; } if (runner != null) { runner.stop(); } DBSeerGUI.liveMonitorPanel.reset(); DBSeerGUI.liveMonitorInfo.reset(); DBSeerGUI.middlewareStatus.setText("Middleware: Connecting..."); startMonitoringButton.setEnabled(false); stopMonitoringButton.setEnabled(false); connectSuccess = true; runner = new MiddlewareClientRunner(id, password, ip, port, currentDatasetPath, this); runner.run(); int sleepCount = 0; while (liveLogProcessor == null || !liveLogProcessor.isStarted()) { Thread.sleep(250); sleepCount += 250; if (!connectSuccess) { return; } if (sleepCount > 10000) { JOptionPane.showMessageDialog(DBSeerGUI.mainFrame, String.format("Failed to receive live logs."), "Message", JOptionPane.PLAIN_MESSAGE); runner.stop(); liveLogProcessor = null; return; } } DBSeerGUI.liveDatasets.clear(); String[] servers = liveLogProcessor.getServers(); for (String s : servers) { DBSeerDataSet newDataset = new DBSeerDataSet(); newDataset.setName(date + "_" + s); OpenDirectoryAction openDir = new OpenDirectoryAction(newDataset); openDir.openWithoutDialog(new File(newDatasetDirectory + File.separator + s)); DBSeerGUI.datasets.addElement(newDataset); newDataset.setCurrent(true); DBSeerGUI.liveDatasets.add(newDataset); } if (servers.length > 1) { DBSeerDataSet newDataset = new DBSeerDataSet(); newDataset.setName(date + "_all"); OpenDirectoryAction openDir = new OpenDirectoryAction(newDataset); openDir.openWithoutDialog(newDatasetDirectory); DBSeerGUI.datasets.addElement(newDataset); newDataset.setCurrent(true); DBSeerGUI.liveDatasets.add(newDataset); } // save last middleware connection DBSeerGUI.userSettings.setLastMiddlewareIP(ip); DBSeerGUI.userSettings.setLastMiddlewarePort(port); DBSeerGUI.userSettings.setLastMiddlewareID(id); XStreamHelper xmlHelper = new XStreamHelper(); xmlHelper.toXML(DBSeerGUI.userSettings, DBSeerGUI.settingsPath); } else if (actionEvent.getSource() == stopMonitoringButton) { int stopMonitoring = JOptionPane.showConfirmDialog(DBSeerGUI.mainFrame, "Do you really want to stop monitoring?", "Stop Monitoring", JOptionPane.YES_NO_OPTION); if (stopMonitoring == JOptionPane.YES_OPTION) { if (runner != null) { runner.stop(); } if (liveLogProcessor != null) { liveLogProcessor.stop(); } for (DBSeerDataSet dataset : DBSeerGUI.liveDatasets) { dataset.setCurrent(false); } boolean isRemoved = false; if (DBSeerGUI.dbscan == null || (DBSeerGUI.dbscan != null && !DBSeerGUI.dbscan.isInitialized())) { JOptionPane.showMessageDialog(DBSeerGUI.mainFrame, String.format( "Not enough transactions for clustering. You need at least %d transactions. Datasets are removed.", DBSeerGUI.settings.dbscanInitPts), "Message", JOptionPane.PLAIN_MESSAGE); for (DBSeerDataSet dataset : DBSeerGUI.liveDatasets) { DBSeerGUI.datasets.removeElement(dataset); } isRemoved = true; } if (!isRemoved) { if (liveLogProcessor != null && !liveLogProcessor.isTxWritingStarted()) { JOptionPane.showMessageDialog(DBSeerGUI.mainFrame, String.format( "Live monitoring has not written any transactions yet. Datasets are removed."), "Message", JOptionPane.PLAIN_MESSAGE); for (DBSeerDataSet dataset : DBSeerGUI.liveDatasets) { DBSeerGUI.datasets.removeElement(dataset); } } } DBSeerGUI.liveDatasets.clear(); if (liveLogProcessor != null) { liveLogProcessor = null; } DBSeerGUI.liveMonitorPanel.reset(); startMonitoringButton.setEnabled(true); stopMonitoringButton.setEnabled(false); DBSeerGUI.middlewareStatus.setText("Middleware: Not Connected"); } // if (DBSeerGUI.dbscan == null || // (DBSeerGUI.dbscan != null && !DBSeerGUI.dbscan.isInitialized())) // { // JOptionPane.showMessageDialog(DBSeerGUI.mainFrame, // String.format("Not enough transactions for clustering. You need at least %d transactions. Dataset is not saved.", DBSeerGUI.settings.dbscanInitPts), // "Message", JOptionPane.PLAIN_MESSAGE); // // DBSeerGUI.liveMonitorPanel.reset(); // DBSeerGUI.liveMonitorInfo.reset(); // // startMonitoringButton.setEnabled(true); // stopMonitoringButton.setEnabled(false); // DBSeerGUI.middlewareStatus.setText("Middleware: Not Connected"); // // return; // } // if (!liveLogProcessor.isTxWritingStarted()) // { // JOptionPane.showMessageDialog(DBSeerGUI.mainFrame, // String.format("Live monitoring has not written any transactions yet. Dataset is not saved."), // "Message", JOptionPane.PLAIN_MESSAGE); // // DBSeerGUI.liveMonitorPanel.reset(); // DBSeerGUI.liveMonitorInfo.reset(); // // startMonitoringButton.setEnabled(true); // stopMonitoringButton.setEnabled(false); // DBSeerGUI.middlewareStatus.setText("Middleware: Not Connected"); // // return; // } // // int saveResult = JOptionPane.showConfirmDialog(DBSeerGUI.mainFrame, "Do you want to save the monitored data?", // "Save monitored data as a dataset", JOptionPane.YES_NO_OPTION); // // if (saveResult == JOptionPane.YES_OPTION) // { // String date = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); // String newDatasetPath = DBSeerGUI.userSettings.getDBSeerRootPath() + File.separator + // DBSeerConstants.ROOT_DATASET_PATH + File.separator + date; // File liveDatasetDirectory = new File(liveDatasetPath); // final File newDatasetDirectory = new File(newDatasetPath); // // // create new dataset directory // FileUtils.forceMkdir(newDatasetDirectory); // // // copy dataset // FileUtils.copyDirectory(liveDatasetDirectory, newDatasetDirectory, false); // // // show message dialog. // JOptionPane.showMessageDialog(DBSeerGUI.mainFrame, // String.format("Dataset has been successfully saved under '%s'", newDatasetDirectory.getCanonicalPath()), // "Message", JOptionPane.PLAIN_MESSAGE); // // String[] servers = liveLogProcessor.getServers(); // for (String s : servers) // { // DBSeerDataSet newDataset = new DBSeerDataSet(); // newDataset.setName(date + "_" + s); // OpenDirectoryAction openDir = new OpenDirectoryAction(newDataset); // openDir.openWithoutDialog(new File(newDatasetDirectory + File.separator + s)); // DBSeerGUI.datasets.addElement(newDataset); // } // if (servers.length > 1) // { // DBSeerDataSet newDataset = new DBSeerDataSet(); // newDataset.setName(date + "_all"); // OpenDirectoryAction openDir = new OpenDirectoryAction(newDataset); // openDir.openWithoutDialog(newDatasetDirectory); // DBSeerGUI.datasets.addElement(newDataset); // } // SaveSettingsAction saveSettings = new SaveSettingsAction(); // saveSettings.actionPerformed(new ActionEvent(this, 0, "")); // } } else if (actionEvent.getSource() == applyRefreshRateButton) { int rate = Integer.parseInt(refreshRateField.getText()); DBSeerGUI.liveMonitorRefreshRate = rate; } } catch (Exception e) { DBSeerExceptionHandler.handleException(e); } // old implementation /* final MiddlewareSocket socket = DBSeerGUI.middlewareSocket; if (actionEvent.getSource() == logInOutButton) { if (!isLoggedIn) { String ip = ipField.getText(); int port = Integer.parseInt(portField.getText()); String id = idField.getText(); String password = String.valueOf(passwordField.getPassword()); try { if (!socket.connect(ip, port)) { return; } if (socket.login(id, password)) { if (socket.isMonitoring(true)) { DBSeerGUI.middlewareStatus.setText("Middleware Connected: " + socket.getIp() + ":" + socket.getPort() + " as " + socket.getId() + " (Monitoring)"); startMonitoringButton.setEnabled(false); stopMonitoringButton.setEnabled(true); } else { DBSeerGUI.middlewareStatus.setText("Middleware Connected: " + socket.getIp() + ":" + socket.getPort() + " as " + socket.getId()); startMonitoringButton.setEnabled(true); stopMonitoringButton.setEnabled(false); } // save last login credentials DBSeerGUI.userSettings.setLastMiddlewareIP(socket.getIp()); DBSeerGUI.userSettings.setLastMiddlewarePort(socket.getPort()); DBSeerGUI.userSettings.setLastMiddlewareID(socket.getId()); XStreamHelper xmlHelper = new XStreamHelper(); xmlHelper.toXML(DBSeerGUI.userSettings, DBSeerGUI.settingsPath); this.setLogin(); } else { JOptionPane.showMessageDialog(null, socket.getErrorMessage(), "Middleware Login Error", JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { DBSeerExceptionHandler.handleException(e, "Middleware Login Error"); // JOptionPane.showMessageDialog(null, e.getMessage(), "Middleware Login Error", JOptionPane.ERROR_MESSAGE); } } else // log out { try { socket.disconnect(); startMonitoringButton.setEnabled(false); stopMonitoringButton.setEnabled(false); } catch (Exception e) { DBSeerExceptionHandler.handleException(e); } } } else if (actionEvent.getSource() == startMonitoringButton) { try { if (socket.startMonitoring()) { DBSeerGUI.middlewareStatus.setText("Middleware Connected: " + socket.getIp() + ":" + socket.getPort() + " as " + socket.getId() + " (Monitoring)"); startMonitoringButton.setEnabled(false); stopMonitoringButton.setEnabled(true); } else { JOptionPane.showMessageDialog(null, socket.getErrorMessage(), "Middleware Monitoring Error", JOptionPane.ERROR_MESSAGE); } } catch (IOException e) { JOptionPane.showMessageDialog(null, e.getMessage(), "Middleware Error", JOptionPane.ERROR_MESSAGE); } } else if (actionEvent.getSource() == stopMonitoringButton) { try { startMonitoringButton.setEnabled(true); stopMonitoringButton.setEnabled(false); if (!socket.isMonitoring(false)) { return; } final String datasetRootPath = DBSeerGUI.userSettings.getDBSeerRootPath() + File.separator + DBSeerConstants.ROOT_DATASET_PATH; final String liveDatasetPath = DBSeerGUI.userSettings.getDBSeerRootPath() + File.separator + DBSeerConstants.LIVE_DATASET_PATH; final File rawDatasetDir = new File(datasetRootPath); if (!rawDatasetDir.exists()) { rawDatasetDir.mkdirs(); } String datasetName = (String)JOptionPane.showInputDialog(this, "Enter the name of new dataset", "New Dataset", JOptionPane.PLAIN_MESSAGE, null, null, "NewDataset"); boolean getData = true; File newRawDatasetDir = null; if (datasetName == null) { getData = false; } else { // newRawDatasetDir = new File(DBSeerConstants.RAW_DATASET_PATH + File.separator + datasetName); newRawDatasetDir = new File(datasetRootPath + File.separator + datasetName); while (newRawDatasetDir.exists()) { datasetName = (String) JOptionPane.showInputDialog(this, datasetName + " already exists.\n" + "Enter the name of new dataset", "New Dataset", JOptionPane.PLAIN_MESSAGE, null, null, "NewDataset"); newRawDatasetDir = new File(datasetRootPath + File.separator + datasetName); } newRawDatasetDir.mkdirs(); } final boolean downloadData = getData; final File datasetDir = newRawDatasetDir; final String datasetNameFinal = datasetName; final JPanel middlewarePanel = this; final JButton logButton = logInOutButton; final JButton startButton = startMonitoringButton; SwingWorker<Void, Void> datasetWorker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { if (downloadData) { DBSeerGUI.status.setText("Stopping monitoring..."); middlewarePanel.setEnabled(false); logButton.setEnabled(false); startButton.setEnabled(false); } if (socket.stopMonitoring(downloadData)) { DBSeerGUI.middlewareStatus.setText("Middleware Connected: " + socket.getIp() + ":" + socket.getPort() + " as " + socket.getId()); DBSeerGUI.liveMonitorPanel.reset(); if (!downloadData) { return null; } // File logFile = socket.getLogFile(); // byte[] buf = new byte[8192]; // int length = 0; // // FileInputStream byteStream = new FileInputStream(logFile); // ZipInputStream zipInputStream = new ZipInputStream(byteStream); // ZipEntry entry = null; // // // unzip the monitor package. // while ((entry = zipInputStream.getNextEntry()) != null) // { // File entryFile = new File(liveDatasetPath + File.separator + entry.getName()); // new File(entryFile.getParent()).mkdirs(); // // FileOutputStream out = new FileOutputStream(liveDatasetPath + File.separator + entry.getName()); // // try // { // while ((length = zipInputStream.read(buf, 0, 8192)) >= 0) // { // out.write(buf, 0, length); // } // } // catch (EOFException e) // { // // do nothing // } // // //zipInputStream.closeEntry(); // out.flush(); // out.close(); // } // zipInputStream.close(); // move dataset from 'temp' to user-specified directory File liveDir = new File(DBSeerGUI.userSettings.getDBSeerRootPath() + File.separator + DBSeerConstants.LIVE_DATASET_PATH); File[] files = liveDir.listFiles(); for (File f : files) { FileUtils.moveFileToDirectory(f, datasetDir, false); } // We may not need to process the data after all? // int confirm = JOptionPane.showConfirmDialog(null, // "The monitoring data has been downloaded.\n" + // "Do you want to proceed and process the downloaded dataset?", // "Warning", // JOptionPane.YES_NO_OPTION); // // if (confirm == JOptionPane.YES_OPTION) // { // // process the dataset // DBSeerGUI.status.setText("Processing the dataset..."); // DataCenter dc = new DataCenter(DBSeerConstants.ROOT_DATASET_PATH, datasetNameFinal, true); // if (!dc.parseLogs()) // { // JOptionPane.showMessageDialog(null, "Failed to parse received monitoring logs", "Error", JOptionPane.ERROR_MESSAGE); // } // // if (!dc.processDataset()) // { // JOptionPane.showMessageDialog(null, "Failed to process received dataset", "Error", JOptionPane.ERROR_MESSAGE); // } // } } else { JOptionPane.showMessageDialog(null, socket.getErrorMessage(), "Middleware Monitoring Error", JOptionPane.ERROR_MESSAGE); } return null; } @Override protected void done() { DBSeerGUI.status.setText(""); middlewarePanel.setEnabled(true); logButton.setEnabled(true); startButton.setEnabled(true); } }; datasetWorker.execute(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); DBSeerGUI.status.setText(""); } } else if (actionEvent.getSource() == applyRefreshRateButton) { int rate = Integer.parseInt(refreshRateField.getText()); DBSeerGUI.liveMonitorRefreshRate = rate; } */ }
From source file:com.dmrr.asistenciasx.Horarios.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try {/*from www. ja v a 2 s.c om*/ int x = jTableHorarios.getSelectedRow(); if (x == -1) { JOptionPane.showMessageDialog(this, "Seleccione un profesor primero", "Datos incompletos", JOptionPane.WARNING_MESSAGE); return; } Integer idProfesor = Integer .parseInt((String) jTableHorarios.getValueAt(jTableHorarios.getSelectedRow(), 1)); JPasswordField pf = new JPasswordField(); String nip = ""; int okCxl = JOptionPane.showConfirmDialog(null, pf, "Introduzca el NIP del jefe del departamento", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (okCxl == JOptionPane.OK_OPTION) { nip = new String(pf.getPassword()); } else { return; } org.jsoup.Connection.Response respuesta = Jsoup .connect("http://siiauescolar.siiau.udg.mx/wus/gupprincipal.valida_inicio") .data("p_codigo_c", "2225255", "p_clave_c", nip).method(org.jsoup.Connection.Method.POST) .timeout(0).execute(); Document login = respuesta.parse(); String sessionId = respuesta.cookie(getFecha() + "SIIAUSESION"); String sessionId2 = respuesta.cookie(getFecha() + "SIIAUUDG"); Document listaHorarios = Jsoup.connect("http://siiauescolar.siiau.udg.mx/wse/sspsecc.consulta_oferta") .data("ciclop", "201510", "cup", "J", "deptop", "", "codprofp", "" + idProfesor, "ordenp", "0", "mostrarp", "1000", "tipop", "T", "secp", "A", "regp", "T") .userAgent("Mozilla").cookie(getFecha() + "SIIAUSESION", sessionId) .cookie(getFecha() + "SIIAUUDG", sessionId2).timeout(0).post(); Elements tabla = listaHorarios.select("body"); tabla.select("style").remove(); Elements font = tabla.select("font"); font.removeAttr("size"); System.out.println(tabla.html()); JEditorPane jEditorPane = new JEditorPane(); jEditorPane.setEditable(false); HTMLEditorKit kit = new HTMLEditorKit(); jEditorPane.setEditorKit(kit); javax.swing.text.Document doc = kit.createDefaultDocument(); jEditorPane.setDocument(doc); jEditorPane.setText(tabla.html()); JOptionPane.showMessageDialog(null, jEditorPane); } catch (IOException ex) { Logger.getLogger(Horarios.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:net.flamefeed.ftb.modpackupdater.FileOperator.java
/** * Obtain the absolute file path for the vanilla Minecraft directory based * on which Operating System is present//from w ww . j a v a 2 s . com */ private void computePathMinecraft() { final String operatingSystem = System.getProperty("os.name"); if (operatingSystem.contains("Windows") || operatingSystem.equals("Linux")) { pathMinecraft = System.getenv("appdata") + "/.minecraft"; } else if (operatingSystem.contains("Mac")) { pathMinecraft = System.getenv("appdata") + "/minecraft"; } else { pathMinecraft = System.getenv("appdata") + "/.minecraft"; pathMinecraft = JOptionPane.showInputDialog(null, "Operating system not recognised, please indicate installation path for vanilla Minecraft launcher.", "Confirm Install Path", JOptionPane.PLAIN_MESSAGE, null, null, pathMinecraft).toString(); } // Replace all \\ which might occur in Windows paths with / to make // it uniform. Sadly this requires a regex of \\, which as a string is \\\\. // Dear god. pathMinecraft = pathMinecraft.replaceAll("\\\\", "/"); // Check validity of Minecraft directory File fileMinecraft = new File(pathMinecraft); if (pathMinecraft.equals("") || (fileMinecraft.exists() && !fileMinecraft.isDirectory())) { System.err.println("Invalid Minecraft installation path"); System.err.println(pathMinecraft); JOptionPane.showMessageDialog(null, "Minecraft installation path is invalid. Installer will now terminate."); System.exit(0); } // Make sure Minecraft directory is present. Does nothing if already there. fileMinecraft.mkdir(); }
From source file:kenh.expl.impl.ExpLParser.java
public static void main(String[] args) { // test splitExpression /*/*from w w w . j a v a 2s .c o m*/ try { String[] ss = splitExpression("1 + {2} + 3"); System.out.println(ArrayUtils.toString(ss)); } catch(UnsupportedExpressionException e) { e.printExpressTrace(); } try { String[] ss = splitExpression("1 + {{2 + 3}+4}+ 5"); System.out.println(ArrayUtils.toString(ss)); } catch(UnsupportedExpressionException e) { e.printExpressTrace(); } try { String[] ss = splitExpression("1 + {{2 + 3}+4}+ 5} + 6"); System.out.println(ArrayUtils.toString(ss)); } catch(UnsupportedExpressionException e) { e.printExpressTrace(); } try { String[] ss = splitExpression("1 + {{2 + {3}+4}+ 5"); System.out.println(ArrayUtils.toString(ss)); } catch(UnsupportedExpressionException e) { e.printExpressTrace(); } System.exit(-1); */ // test splitParameter /* try { String[] ss = splitParameter("1 + {2 + {3}+4}+ 5, abc,e{f{g}}, {#hi({a},b,c)}jk,lmn,,,o,qpr"); System.out.println(ss.length + ">> " + ArrayUtils.toString(ss)); } catch(UnsupportedExpressionException e) { e.printExpressTrace(); } try { String[] ss = splitParameter("1 + {2 + {3}+4}+ 5, abc,e{fg, {hi}jk,lmn,,,o,qpr"); System.out.println(ss.length + ">> " + ArrayUtils.toString(ss)); } catch(UnsupportedExpressionException e) { e.printExpressTrace(); } try { String[] ss = splitParameter("1 + {2 + {3}+4}+ 5, abc,e{fg}}, {hi}jk,lmn,,,o,qpr"); System.out.println(ss.length + ">> " + ArrayUtils.toString(ss)); } catch(UnsupportedExpressionException e) { e.printExpressTrace(); } System.exit(-1); */ Environment env = new Environment(); while (true) { String express = javax.swing.JOptionPane.showInputDialog(null, "Expression: ", "EXPL", JOptionPane.PLAIN_MESSAGE); if (express == null) break; try { System.out.println(env.parse(express)); } catch (Exception e) { e.printStackTrace(); } } env.callback(); }