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:com.tiempometa.muestradatos.JMuestraDatos.java
private void exportTagsMenuItemActionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); int response = fc.showSaveDialog(this); if (response == JFileChooser.APPROVE_OPTION) { TagExcelExporter exporter = new TagExcelExporter(); try {//from w w w .j a v a 2 s. co m exporter.open(fc.getSelectedFile()); List<Rfid> rfidList = rfidDao.findAll(); exporter.export(rfidList); JOptionPane.showMessageDialog(this, "Se exportaron los tags con xito", "Exportar Tags", JOptionPane.PLAIN_MESSAGE); } catch (IOException e1) { JOptionPane.showMessageDialog(this, "Error exportando " + e1.getMessage(), "Exportar Tags", JOptionPane.ERROR_MESSAGE); } catch (SQLException e1) { JOptionPane.showMessageDialog(this, "Error exportando " + e1.getMessage(), "Exportar Tags", JOptionPane.ERROR_MESSAGE); } catch (RowsExceededException e1) { JOptionPane.showMessageDialog(this, "Error exportando " + e1.getMessage(), "Exportar Tags", JOptionPane.ERROR_MESSAGE); } catch (WriteException e1) { JOptionPane.showMessageDialog(this, "Error exportando " + e1.getMessage(), "Exportar Tags", JOptionPane.ERROR_MESSAGE); } } }
From source file:gda.gui.mca.McaGUI.java
private void makeAdcControlDialog() { if (adcControlPanel == null) { adcControlPanel = new AdcPanel(); adcDialog = new JDialog(); Object[] options = { "OK" }; Object[] array = { adcControlPanel }; // Create the JOptionPane. final JOptionPane optionPane = new JOptionPane(array, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_OPTION, null, options, options[0]); optionPane.addPropertyChangeListener(new PropertyChangeListener() { @Override// w ww. java2 s.c om public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (isVisible() && (e.getSource() == optionPane) && (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) { Object value = optionPane.getValue(); if (value == JOptionPane.UNINITIALIZED_VALUE) { // ignore reset return; } // Reset the JOptionPane's value. // If you don't do this, then if the user // presses the same button next time, no // property change event will be fired. optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE); if ("OK".equals(value)) { adcDialog.setVisible(false); } } } }); adcDialog.setContentPane(optionPane); adcDialog.pack(); adcDialog.setTitle("ADC Controls"); adcDialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); } }
From source file:com.vgi.mafscaling.VECalc.java
protected void loadLogFile() { fileChooser.setMultiSelectionEnabled(true); if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this)) return;//ww w. ja v a2s. co m File[] files = fileChooser.getSelectedFiles(); for (File file : files) { BufferedReader br = null; ArrayDeque<String[]> buffer = new ArrayDeque<String[]>(); try { br = new BufferedReader(new FileReader(file.getAbsoluteFile())); String line = br.readLine(); if (line != null) { String[] elements = line.split("(\\s*)?,(\\s*)?", -1); getColumnsFilters(elements); boolean resetColumns = false; if (logThrottleAngleColIdx >= 0 || logFfbColIdx >= 0 || logSdColIdx >= 0 || (logWbAfrColIdx >= 0 && isOl) || (logStockAfrColIdx >= 0 && !isOl) || (logAfLearningColIdx >= 0 && !isOl) || (logAfCorrectionColIdx >= 0 && !isOl) || logRpmColIdx >= 0 || logMafColIdx >= 0 || logIatColIdx >= 0 || logMpColIdx >= 0) { if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null, "Would you like to reset column names or filter values?", "Columns/Filters Reset", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE)) resetColumns = true; } if (resetColumns || logThrottleAngleColIdx < 0 || logFfbColIdx < 0 || logSdColIdx < 0 || (logWbAfrColIdx < 0 && isOl) || (logStockAfrColIdx < 0 && !isOl) || (logAfLearningColIdx < 0 && !isOl) || (logAfCorrectionColIdx < 0 && !isOl) || logRpmColIdx < 0 || logMafColIdx < 0 || logIatColIdx < 0 || logMpColIdx < 0) { ColumnsFiltersSelection selectionWindow = new VEColumnsFiltersSelection(false); if (!selectionWindow.getUserSettings(elements) || !getColumnsFilters(elements)) return; } if (logClOlStatusColIdx == -1) clValue = -1; String[] flds; String[] afrflds; boolean removed = false; int i = 2; int clol = -1; int row = getLogTableEmptyRow(); double thrtlMaxChange2 = thrtlMaxChange + thrtlMaxChange / 2.0; double throttle = 0; double pThrottle = 0; double ppThrottle = 0; double afr = 0; double rpm; double ffb; double iat; clearRunTables(); setCursor(new Cursor(Cursor.WAIT_CURSOR)); for (int k = 0; k <= afrRowOffset && line != null; ++k) { line = br.readLine(); if (line != null) buffer.addFirst(line.split(",", -1)); } try { while (line != null && buffer.size() > afrRowOffset) { afrflds = buffer.getFirst(); flds = buffer.removeLast(); line = br.readLine(); if (line != null) buffer.addFirst(line.split(",", -1)); ppThrottle = pThrottle; pThrottle = throttle; throttle = Double.valueOf(flds[logThrottleAngleColIdx]); try { if (row > 0 && Math.abs(pThrottle - throttle) > thrtlMaxChange) { if (!removed) Utils.removeRow(row--, logDataTable); removed = true; } else if (row <= 0 || Math.abs(ppThrottle - throttle) <= thrtlMaxChange2) { // Filters afr = (isOl ? Double.valueOf(afrflds[logWbAfrColIdx]) : Double.valueOf(afrflds[logStockAfrColIdx])); rpm = Double.valueOf(flds[logRpmColIdx]); ffb = Double.valueOf(flds[logFfbColIdx]); iat = Double.valueOf(flds[logIatColIdx]); if (clValue != -1) clol = Integer.valueOf(flds[logClOlStatusColIdx]); boolean flag = isOl ? ((afr <= afrMax || throttle >= thrtlMin) && afr <= afrMax) : (afrMin <= afr); if (flag && clol == clValue && rpmMin <= rpm && ffbMin <= ffb && ffb <= ffbMax && iat <= iatMax) { removed = false; if (!isOl) trims.add(Double.valueOf(flds[logAfLearningColIdx]) + Double.valueOf(flds[logAfCorrectionColIdx])); Utils.ensureRowCount(row + 1, logDataTable); logDataTable.setValueAt(rpm, row, 0); logDataTable.setValueAt(iat, row, 1); logDataTable.setValueAt(Double.valueOf(flds[logMpColIdx]), row, 2); logDataTable.setValueAt(ffb, row, 3); logDataTable.setValueAt(afr, row, 4); logDataTable.setValueAt(Double.valueOf(flds[logMafColIdx]), row, 5); logDataTable.setValueAt(Double.valueOf(flds[logSdColIdx]), row, 6); row += 1; } else removed = true; } else removed = true; } catch (NumberFormatException e) { logger.error(e); JOptionPane.showMessageDialog(null, "Error parsing number at " + file.getName() + " line " + i + ": " + e, "Error processing file", JOptionPane.ERROR_MESSAGE); return; } i += 1; } } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } } } catch (Exception e) { logger.error(e); JOptionPane.showMessageDialog(null, e, "Error opening file", JOptionPane.ERROR_MESSAGE); } finally { if (br != null) { try { br.close(); } catch (IOException e) { logger.error(e); } } } } }
From source file:nl.phanos.liteliveresultsclient.gui.ResultsWindows.java
private void ChangeIpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ChangeIpActionPerformed // TODO add your handling code here: Object s = ""; do {//from w w w.j a v a 2s . c o m s = JOptionPane.showInputDialog(this, "Geef Ip van MacFinish op", "ip", JOptionPane.PLAIN_MESSAGE, null, null, clockServer.getIp()); } while (!InetAddressUtils.isIPv4Address((String) s)); clockServer.changeIp((String) s); }
From source file:edu.mit.fss.examples.visual.gui.WorldWindVisualization.java
/** * Shows this visualization's options dialog. *///from w ww.j a va 2 s .c o m private void showOptionsDialog() { JOptionPane.showMessageDialog(this, optionsPanel, "Edit Options", JOptionPane.PLAIN_MESSAGE); }
From source file:com.tiempometa.muestradatos.JMuestraDatos.java
private void clearTagsMenuItemActionPerformed(ActionEvent e) { int response = JOptionPane.showConfirmDialog(this, "Seguro que desea borrar todos los tags? Esta operacin no se puede deshacer", "Borrar tags", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (response == JOptionPane.YES_OPTION) { try {/*from w ww .ja v a 2s .co m*/ rfidDao.deleteAll(); JOptionPane.showMessageDialog(this, "Se borraron todos los tags", "Despejar Tags", JOptionPane.PLAIN_MESSAGE); } catch (SQLException e1) { JOptionPane.showMessageDialog(this, "Error despejando tags " + e1.getMessage(), "Despejar Tags", JOptionPane.ERROR_MESSAGE); } } }
From source file:canreg.client.gui.management.CanReg4MigrationInternalFrame.java
private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked // TODO add your handling code here: list = (JList) evt.getSource(); if (list.getModel().getSize() > 0) { if (list.isSelectedIndex(list.getSelectedIndex())) { okButton.setEnabled(true);//from w w w . ja va2 s.c o m } regcode = registryCodes.get(list.getSelectedIndex()); filepath = paths.get(list.getSelectedIndex()); DBSearch dbs = new DBSearch(); File[] dbList = dbs.getDBList(filepath); int dbSearch = (dbs.searchDB(dbList)) ? 1 : 0; switch (dbSearch) { case 0: okButton.setEnabled(false); JOptionPane.showConfirmDialog(CanRegClientApp.getApplication().getMainFrame().getContentPane(), "'" + dlm.get(list.getSelectedIndex()) + "' DB Files are Missing.\nPlease Confirm Location '" + CR4Path + regcode + "'", "Missing DB Files.", JOptionPane.PLAIN_MESSAGE); break; case 1: String dicFile = dbs.getDicDB(dbList); String datFile = dbs.getDatDB(dbList); if (dicFile == null || datFile == null) { okButton.setEnabled(false); JOptionPane.showConfirmDialog(CanRegClientApp.getApplication().getMainFrame().getContentPane(), "'" + dlm.get(list.getSelectedIndex()) + "' DB Files are Missing.\nPlease Confirm Location '" + CR4Path + regcode + "'", "Missing DB Files.", JOptionPane.PLAIN_MESSAGE); } if (dicFile != null && datFile != null) { String dicname = "CR4-" + regcode + "D.DB"; String dataname = "CR4-" + regcode + "M.DB"; int dicdb = dicFile.equalsIgnoreCase(dicname) ? 1 : 0; int datdb = datFile.equalsIgnoreCase(dataname) ? 1 : 0; switch (dicdb) { case 0: okButton.setEnabled(false); JOptionPane.showConfirmDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), "Incorrect Dictionary Name.\nExpected: " + dicname + ", Found " + dicFile, "Incorrect Dictionary File Name.", JOptionPane.PLAIN_MESSAGE); switch (datdb) { case 0: okButton.setEnabled(false); JOptionPane.showConfirmDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), "Incorrect Data Name.\nExpected: " + dataname + ", Found " + datFile, "Incorrect Data File Name.", JOptionPane.PLAIN_MESSAGE); break; case 1: okButton.setEnabled(false); break; } break; case 1: switch (datdb) { case 0: okButton.setEnabled(false); JOptionPane.showConfirmDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), "Incorrect Data Name.\nExpected: " + dataname + ", Found " + datFile, "Incorect Data File Name.", JOptionPane.PLAIN_MESSAGE); break; case 1: dictionary = dicFile; data = datFile; okButton.setEnabled(true); break; } break; } } break; } } }
From source file:net.pms.newgui.GeneralTab.java
public void addPlugins() { FormLayout layout = new FormLayout("fill:10:grow", "p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p, p"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); int i = 1;/*w w w . j a v a 2s. co m*/ for (final ExternalListener listener : ExternalFactory.getExternalListeners()) { if (i > 30) { logger.warn("Plugin limit of 30 has been reached"); break; } JButton bPlugin = new JButton(listener.name()); // listener to show option screen bPlugin.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showOptionDialog( (JFrame) (SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame())), listener.config(), Messages.getString("Dialog.Options"), JOptionPane.CLOSED_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null); } }); builder.add(bPlugin, cc.xy(1, i++)); } pPlugins.add(builder.getPanel()); }
From source file:lu.fisch.moenagade.model.Project.java
public boolean renameSound(SoundFile soundFile) { String name = getFilename(soundFile); String ext = getExtension(soundFile); boolean result; do {//from w w w .ja v a2s . c o m result = true; name = (String) JOptionPane.showInputDialog(frame, "Please enter the sound's new name.", "Rename sound", JOptionPane.PLAIN_MESSAGE, null, null, name); if (name == null) return false; // 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 ((new File(directoryName + System.getProperty("file.separator") + "bloxs" + System.getProperty("file.separator") + "sounds" + System.getProperty("file.separator") + name + "." + ext)).exists()) { result = false; JOptionPane.showMessageDialog(frame, "There exists already a sound with this name!", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } else { // send refresh refresh(new Change(null, -1, "rename.sound", soundFile.toString(), name + "." + ext)); // do the rename File fFrom = new File(directoryName + System.getProperty("file.separator") + "bloxs" + System.getProperty("file.separator") + "sounds" + System.getProperty("file.separator") + soundFile.toString()); File fTo = new File(directoryName + System.getProperty("file.separator") + "bloxs" + System.getProperty("file.separator") + "sounds" + System.getProperty("file.separator") + name + "." + ext); if (fFrom.exists()) fFrom.renameTo(fTo); return true; } } while (!result); return false; }
From source file:org.gumtree.vis.plot1d.Plot1DPanel.java
private void showPropertyEditor(int tabIndex) { XYDataset dataset = getChart().getXYPlot().getDataset(); if (selectedSeriesIndex >= 0 && selectedSeriesIndex < dataset.getSeriesCount()) { Plot1DChartEditor.setSuggestedSeriesKey((String) dataset.getSeriesKey(selectedSeriesIndex)); }//ww w.j a v a 2s . co m Plot1DChartEditor editor = new Plot1DChartEditor(getChart(), this); editor.getTabs().setSelectedIndex(tabIndex); int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { editor.updateChart(getChart()); } }