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:org.rdv.viz.chart.ChartPanel.java
/** * Displays a dialog that allows the user to edit the properties for the * current chart./*www .j a va 2 s. c o m*/ * * @since 1.0.3 */ public void doEditChartProperties() { ChartEditor editor = ChartEditorManager.getChartEditor(this.chart); int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { editor.updateChart(this.chart); } }
From source file:com.osparking.attendant.AttListForm.java
private void multiFuncButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiFuncButtonActionPerformed String[] errorMsg = new String[1]; try {/* ww w. ja v a 2 s . c om*/ switch (formMode) { case NormalMode: // <editor-fold defaultstate="collapsed" desc="-- Prepare to update user information"> setFormMode(FormMode.UpdateMode); multiFuncButton.setText(SAVE_BTN.getContent()); multiFuncButton.setEnabled(false); multiFuncButton.setMnemonic('s'); setModificationState(true); // change to modification mode createButton.setEnabled(false); deleteButton.setEnabled(false); break; // </editor-fold> case UpdateMode: // <editor-fold defaultstate="collapsed" desc="-- save modified user information "> if (allFieldsAreGood(errorMsg)) { // each field satisfies data requirements setFormMode(FormMode.NormalMode); multiFuncButton.setText(MODIFY_BTN.getContent()); multiFuncButton.setMnemonic('m'); setModificationState(false); int result = saveUpdatedRecord(); doAfterUpdateOperations(result); } else { if (errorMsg[0].length() > 0) { showMessageDialog(this, errorMsg[0]); } } break; // </editor-fold> case CreateMode: // <editor-fold defaultstate="collapsed" desc="-- Complete user creation operation"> if (!ID_usable) { JOptionPane.showConfirmDialog(this, ID_CHECK_DIALOG.getContent(), CREATTION_FAIL_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE); return; } if (!Email_usable) { JOptionPane.showConfirmDialog(this, EMAIL_CHECK_DIALOG.getContent(), CREATTION_FAIL_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE); return; } if (allFieldsAreGood(errorMsg)) { String newUserID = userIDText.getText().trim(); int result = saveCreatedRecord(); String dialogText = ""; if (result == 1) { // 1 record inserted == insertion success. // <editor-fold defaultstate="collapsed" desc="-- Refresh user list while maintaining sort order"> List sortKeys = usersTable.getRowSorter().getSortKeys(); /** * List newly created user on the list in any case. */ loadAttendantTable(newUserID); usersTable.getRowSorter().setSortKeys(sortKeys); int selectIndex = searchRow(newUserID); if (selectIndex < 0) selectIndex = 0; usersTable.changeSelection(selectIndex, 0, false, false); usersTable.requestFocus(); changeFieldButtonUsability(selectIndex); // </editor-fold> revokeCreationMode(); dialogText = ATT_CREATE_DIAG_1.getContent() + System.lineSeparator() + ATT_CREATE_DIAG_2.getContent() + newUserID; JOptionPane.showMessageDialog(this, dialogText, CREATION_RESULT_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE); } else { dialogText = ATT_FAILED_DIAG_1.getContent() + System.lineSeparator() + ATT_CREATE_DIAG_2.getContent() + newUserID; showMessageDialog(this, dialogText, CREATION_RESULT_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE); } } else { if (errorMsg[0].length() > 0) { showMessageDialog(this, errorMsg[0], USER_FIELD_CHECK_RESULT.getContent(), JOptionPane.WARNING_MESSAGE); } } break; // </editor-fold> default: } } catch (Exception ex) { logParkingException(Level.SEVERE, ex, "(User requested command: " + evt.getActionCommand() + ")"); } }
From source file:com.nikonhacker.gui.EmulatorUI.java
private void openAnalyseDialog(final int chip) { JTextField optionsField = new JTextField(); JTextField destinationField = new JTextField(); // compute and try default names for options file. // In order : <firmware>.dfr.txt , <firmware>.txt , dfr.txt (or the same for dtx) File optionsFile = new File(imageFile[chip].getParentFile(), FilenameUtils.getBaseName(imageFile[chip].getAbsolutePath()) + ((chip == Constants.CHIP_FR) ? ".dfr.txt" : ".dtx.txt")); if (!optionsFile.exists()) { optionsFile = new File(imageFile[chip].getParentFile(), FilenameUtils.getBaseName(imageFile[chip].getAbsolutePath()) + ".txt"); if (!optionsFile.exists()) { optionsFile = new File(imageFile[chip].getParentFile(), ((chip == Constants.CHIP_FR) ? "dfr.txt" : "dtx.txt")); if (!optionsFile.exists()) { optionsFile = null;//from www . j av a2s . c o m } } } if (optionsFile != null) { optionsField.setText(optionsFile.getAbsolutePath()); } // compute default name for output File outputFile = new File(imageFile[chip].getParentFile(), FilenameUtils.getBaseName(imageFile[chip].getAbsolutePath()) + ".asm"); destinationField.setText(outputFile.getAbsolutePath()); final JCheckBox writeOutputCheckbox = new JCheckBox("Write disassembly to file"); final FileSelectionPanel destinationFileSelectionPanel = new FileSelectionPanel("Destination file", destinationField, false); destinationFileSelectionPanel.setFileFilter(".asm", "Assembly language file (*.asm)"); writeOutputCheckbox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { boolean writeToFile = writeOutputCheckbox.isSelected(); destinationFileSelectionPanel.setEnabled(writeToFile); prefs.setWriteDisassemblyToFile(chip, writeToFile); } }); writeOutputCheckbox.setSelected(prefs.isWriteDisassemblyToFile(chip)); destinationFileSelectionPanel.setEnabled(prefs.isWriteDisassemblyToFile(chip)); FileSelectionPanel fileSelectionPanel = new FileSelectionPanel( (chip == Constants.CHIP_FR) ? "Dfr options file" : "Dtx options file", optionsField, false); fileSelectionPanel.setFileFilter((chip == Constants.CHIP_FR) ? ".dfr.txt" : ".dtx.txt", (chip == Constants.CHIP_FR) ? "Dfr options file (*.dfr.txt)" : "Dtx options file (*.dtx.txt)"); final JComponent[] inputs = new JComponent[] { //new FileSelectionPanel("Source file", sourceFile, false, dependencies), fileSelectionPanel, writeOutputCheckbox, destinationFileSelectionPanel, makeOutputOptionCheckBox(chip, OutputOption.STRUCTURE, prefs.getOutputOptions(chip), true), makeOutputOptionCheckBox(chip, OutputOption.ORDINAL, prefs.getOutputOptions(chip), true), makeOutputOptionCheckBox(chip, OutputOption.PARAMETERS, prefs.getOutputOptions(chip), true), makeOutputOptionCheckBox(chip, OutputOption.INT40, prefs.getOutputOptions(chip), true), makeOutputOptionCheckBox(chip, OutputOption.MEMORY, prefs.getOutputOptions(chip), true), new JLabel("(hover over the options for help. See also 'Tools/Options/Disassembler output')", SwingConstants.CENTER) }; if (JOptionPane.OK_OPTION == JOptionPane.showOptionDialog(this, inputs, "Choose analyse options", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, JOptionPane.DEFAULT_OPTION)) { String outputFilename = writeOutputCheckbox.isSelected() ? destinationField.getText() : null; boolean cancel = false; if (outputFilename != null) { if (new File(outputFilename).exists()) { if (JOptionPane.showConfirmDialog(this, "File '" + outputFilename + "' already exists.\nDo you really want to overwrite it ?", "File exists", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION) { cancel = true; } } } if (!cancel) { AnalyseProgressDialog analyseProgressDialog = new AnalyseProgressDialog(this, framework.getPlatform(chip).getMemory()); analyseProgressDialog.startBackgroundAnalysis(chip, optionsField.getText(), outputFilename); analyseProgressDialog.setVisible(true); } } }
From source file:edu.harvard.i2b2.patientSet.ui.PatientSetJPanel.java
@SuppressWarnings("rawtypes") public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equalsIgnoreCase("Rename ...")) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent(); if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryMasterData")) { QueryMasterData ndata = (QueryMasterData) node.getUserObject(); Object inputValue = JOptionPane.showInputDialog(this, "Rename this query to: ", "Rename Query Dialog", JOptionPane.PLAIN_MESSAGE, null, null, ndata.name().substring(0, ndata.name().indexOf("[") - 1)); if (inputValue != null) { String newQueryName = (String) inputValue; String requestXml = ndata.writeRenameQueryXML(newQueryName); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = null; if (System.getProperty("webServiceMethod").equals("SOAP")) { // TO DO // response = // QueryListNamesClient.sendQueryRequestSOAP(requestXml); } else { response = QueryListNamesClient.sendQueryRequestREST(requestXml, true); }//from w w w . j a v a 2 s . com if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } if (response != null) { JAXBUtil jaxbUtil = PatientSetJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); if (status.equalsIgnoreCase("DONE")) { // XMLGregorianCalendar cldr = // //queryMasterType.getCreateDate(); Calendar cldr = Calendar.getInstance(Locale.getDefault()); ndata.name(newQueryName + " [" + addZero(cldr.get(Calendar.MONTH) + 1) + "-" + addZero(cldr.get(Calendar.DAY_OF_MONTH)) + "-" + addZero(cldr.get(Calendar.YEAR)) + " ]" + " [" + ndata.userId() + "]"); // ndata.name(newQueryName + " [" + // ndata.userId() // + "]"); node.setUserObject(ndata); // DefaultMutableTreeNode parent = // (DefaultMutableTreeNode) node.getParent(); jTree1.repaint(); } } catch (Exception ex) { ex.printStackTrace(); } } } } else if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryResultData")) { QueryResultData rdata = (QueryResultData) node.getUserObject(); // if(!rdata.type().equalsIgnoreCase("PatientSet")) { // return; // } Object inputValue1 = JOptionPane.showInputDialog(this, "Rename this to: ", "Renaming Dialog", JOptionPane.PLAIN_MESSAGE, null, null, rdata.name()); // .substring(0, rdata.name().lastIndexOf("[") - 1)); if (inputValue1 != null) { String newQueryName = (String) inputValue1; String requestXml = rdata.writeRenameQueryXML(newQueryName); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = null; if (System.getProperty("webServiceMethod").equals("SOAP")) { // TO DO // response = // QueryListNamesClient.sendQueryRequestSOAP(requestXml); } else { response = QueryListNamesClient.sendQueryRequestREST(requestXml, true); } if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } if (response != null) { JAXBUtil jaxbUtil = PatientSetJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); if (status.equalsIgnoreCase("DONE")) { rdata.name(newQueryName);// + " [" + // rdata.userId() // + "]"); node.setUserObject(rdata); // DefaultMutableTreeNode parent = // (DefaultMutableTreeNode) node.getParent(); jTree1.repaint(); } else { final String tmp = response; final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Error message delivered from the remote server, " + "you may wish to retry your last action", "Server Error", JOptionPane.INFORMATION_MESSAGE); log.error(tmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); return; } } catch (Exception ex) { ex.printStackTrace(); } } } } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } else if (e.getActionCommand().equalsIgnoreCase("Cancel")) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent(); if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryMasterData")) { DefaultMutableTreeNode node1 = (DefaultMutableTreeNode) node.getFirstChild(); if (node1.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryMasterData")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Please expand this node then try to cancel it.", "Message", JOptionPane.INFORMATION_MESSAGE); } }); return; } QueryInstanceData rdata = (QueryInstanceData) node1.getUserObject(); String requestXml = rdata.writeCancelQueryXML(); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = null; if (System.getProperty("webServiceMethod").equals("SOAP")) { // TO DO // response = // QueryListNamesClient.sendQueryRequestSOAP(requestXml); } else { response = QueryListNamesClient.sendQueryRequestREST(requestXml, true); } if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } if (response != null) { JAXBUtil jaxbUtil = PatientSetJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); final JPanel parent = this; if (status.equalsIgnoreCase("DONE")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "The query is finished.", "Message", JOptionPane.INFORMATION_MESSAGE); // log.error(tmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); rdata.name(rdata.name().substring(0, rdata.name().indexOf("-")));// + " [" + // rdata // .userId() // + "]"); node.setUserObject(rdata); // DefaultMutableTreeNode parent = // (DefaultMutableTreeNode) node.getParent(); jTree1.repaint(); } else { final String tmp = response; // final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Error message delivered from the remote server, " + "you may wish to retry your last action", "Server Error", JOptionPane.INFORMATION_MESSAGE); log.error(tmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); return; } } catch (Exception ex) { ex.printStackTrace(); } // } } } else if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryInstanceData")) { QueryInstanceData rdata = (QueryInstanceData) node.getUserObject(); String requestXml = rdata.writeCancelQueryXML(); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = null; if (System.getProperty("webServiceMethod").equals("SOAP")) { // TO DO // response = // QueryListNamesClient.sendQueryRequestSOAP(requestXml); } else { response = QueryListNamesClient.sendQueryRequestREST(requestXml, true); } if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } if (response != null) { JAXBUtil jaxbUtil = PatientSetJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); final JPanel parent = this; if (status.equalsIgnoreCase("DONE")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "The query is finished.", "Message", JOptionPane.INFORMATION_MESSAGE); // log.error(tmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); rdata.name(rdata.name().substring(0, rdata.name().indexOf("-")));// + " [" + // rdata // .userId() // + "]"); node.setUserObject(rdata); // DefaultMutableTreeNode parent = // (DefaultMutableTreeNode) node.getParent(); jTree1.repaint(); } else { final String tmp = response; // final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Error message delivered from the remote server, " + "you may wish to retry your last action", "Server Error", JOptionPane.INFORMATION_MESSAGE); log.error(tmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); return; } } catch (Exception ex) { ex.printStackTrace(); } // } } } else { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Cancel action is not supported on this level", "Message", JOptionPane.INFORMATION_MESSAGE); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } else if (e.getActionCommand().equalsIgnoreCase("Delete")) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent(); QueryMasterData ndata = (QueryMasterData) node.getUserObject(); Object selectedValue = JOptionPane.showConfirmDialog(this, "Delete Query \"" + ndata.name() + "\"?", "Delete Query Dialog", JOptionPane.YES_NO_OPTION); if (selectedValue.equals(JOptionPane.YES_OPTION)) { System.out.println("delete " + ndata.name()); String requestXml = ndata.writeDeleteQueryXML(); // System.out.println(requestXml); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = null; if (System.getProperty("webServiceMethod").equals("SOAP")) { // TO DO // response = // QueryListNamesClient.sendQueryRequestSOAP(requestXml); } else { response = QueryListNamesClient.sendQueryRequestREST(requestXml, true); } if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } if (response != null) { JAXBUtil jaxbUtil = PatientSetJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); if (status.equalsIgnoreCase("DONE")) { treeModel.removeNodeFromParent(node); // jTree1.repaint(); } } catch (Exception ex) { ex.printStackTrace(); } } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } } else if (e.getActionCommand().equalsIgnoreCase("Refresh All")) { String status = ""; if (isManager) { status = loadPreviousQueries(true); } else { status = loadPreviousQueries(false); } loadPatientSets(); if (status.equalsIgnoreCase("")) { reset(200, false, false); } else if (status.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); } } }
From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java
/** * Displays a dialog that allows the user to edit the properties for the current chart. * //from w w w .j ava 2s .co m * @since 1.0.3 */ @Override public void doEditChartProperties() { ChartEditor editor = ChartEditorManager.getChartEditor(this.chart); int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { editor.updateChart(this.chart); } }
From source file:com.nikonhacker.gui.EmulatorUI.java
private void openUIOptionsDialog() { JPanel options = new JPanel(new GridLayout(0, 1)); options.setName("User Interface"); // Button size ActionListener buttonSizeRadioListener = new ActionListener() { @Override//from w w w . ja v a2s . c o m public void actionPerformed(ActionEvent e) { prefs.setButtonSize(e.getActionCommand()); } }; JRadioButton small = new JRadioButton("Small"); small.setActionCommand(BUTTON_SIZE_SMALL); small.addActionListener(buttonSizeRadioListener); if (BUTTON_SIZE_SMALL.equals(prefs.getButtonSize())) small.setSelected(true); JRadioButton medium = new JRadioButton("Medium"); medium.setActionCommand(BUTTON_SIZE_MEDIUM); medium.addActionListener(buttonSizeRadioListener); if (BUTTON_SIZE_MEDIUM.equals(prefs.getButtonSize())) medium.setSelected(true); JRadioButton large = new JRadioButton("Large"); large.setActionCommand(BUTTON_SIZE_LARGE); large.addActionListener(buttonSizeRadioListener); if (BUTTON_SIZE_LARGE.equals(prefs.getButtonSize())) large.setSelected(true); ButtonGroup group = new ButtonGroup(); group.add(small); group.add(medium); group.add(large); // Close windows on stop final JCheckBox closeAllWindowsOnStopCheckBox = new JCheckBox("Close all windows on Stop"); closeAllWindowsOnStopCheckBox.setSelected(prefs.isCloseAllWindowsOnStop()); // Refresh interval JPanel refreshIntervalPanel = new JPanel(); final JTextField refreshIntervalField = new JTextField(5); refreshIntervalPanel.add(new JLabel("Refresh interval for cpu, screen, etc. (ms):")); refreshIntervalField.setText("" + prefs.getRefreshIntervalMs()); refreshIntervalPanel.add(refreshIntervalField); // Setup panel options.add(new JLabel("Button size :")); options.add(small); options.add(medium); options.add(large); options.add(closeAllWindowsOnStopCheckBox); options.add(refreshIntervalPanel); options.add(new JLabel("Larger value greatly increases emulation speed")); if (JOptionPane.OK_OPTION == JOptionPane.showOptionDialog(this, options, "Preferences", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, JOptionPane.DEFAULT_OPTION)) { // save prefs.setButtonSize(group.getSelection().getActionCommand()); prefs.setCloseAllWindowsOnStop(closeAllWindowsOnStopCheckBox.isSelected()); int refreshIntervalMs = 0; try { refreshIntervalMs = Integer.parseInt(refreshIntervalField.getText()); } catch (NumberFormatException e) { // noop } refreshIntervalMs = Math.max(Math.min(refreshIntervalMs, 10000), 10); prefs.setRefreshIntervalMs(refreshIntervalMs); applyPrefsToUI(); } }
From source file:com.osparking.attendant.AttListForm.java
private void deleteAttendant() { /**/*from w w w. java 2s . com*/ * Check if the user/attendant were deletable (not referenced from other tuple) * This checking involves two tables: Car_Arrival, LoginRecord */ Connection conn = null; PreparedStatement updateStmt = null; String deleteID = userIDText.getText(); int relatedRecordCount = DB_Access.getRecordCount("car_arrival", "AttendantID", deleteID); if (relatedRecordCount > 0) { String dialogMessage = ATT_CANT_DEL_1.getContent() + System.lineSeparator() + ATT_CANT_DEL_2.getContent() + userIDText.getText() + System.lineSeparator() + ATT_CANT_DEL_3.getContent() + relatedRecordCount + ATT_CANT_DEL_4.getContent() + System.lineSeparator() + ATT_CANT_DEL_5.getContent(); JOptionPane.showMessageDialog(this, dialogMessage, DELETE_RESULT_DIALOGTITLE.getContent(), JOptionPane.WARNING_MESSAGE); return; } relatedRecordCount = DB_Access.getRecordCount("loginrecord", "UserID", deleteID); if (relatedRecordCount > 0) { String dialogMessage = ATT_CANT_DEL_1.getContent() + System.lineSeparator() + ATT_CANT_DEL_2.getContent() + userIDText.getText() + System.lineSeparator() + ATT_CANT_DEL_3L.getContent() + relatedRecordCount + ATT_CANT_DEL_4L.getContent() + System.lineSeparator() + ATT_CANT_DEL_5L.getContent(); JOptionPane.showMessageDialog(this, dialogMessage, DELETE_RESULT_DIALOGTITLE.getContent(), JOptionPane.WARNING_MESSAGE); return; } String sql = "Delete From users_osp WHERE id = ?"; try { conn = JDBCMySQL.getConnection(); updateStmt = conn.prepareStatement(sql); updateStmt.setString(1, deleteID); int result = updateStmt.executeUpdate(); if (result == 1) { List sortKeys = usersTable.getRowSorter().getSortKeys(); int selectIndex = usersTable.getSelectedRow(); if (loadAttendantTable("") == 0) { clearDetailsForEmptyList(); } else { usersTable.getRowSorter().setSortKeys(sortKeys); if (selectIndex == usersTable.getRowCount()) { selectIndex--; } selectIndex = usersTable.convertRowIndexToModel(selectIndex); usersTable.changeSelection(selectIndex, 0, false, false); usersTable.requestFocus(); } logParkingOperation(OpLogLevel.UserCarChange, ("* User deleted (ID:" + deleteID + ")")); String dialogMessage = ATT_DEL_SUCC_1.getContent() + deleteID + ATT_DEL_SUCC_2.getContent() + System.lineSeparator() + ATT_DEL_SUCC_3.getContent(); JOptionPane.showMessageDialog(this, dialogMessage, DELETE_RESULT_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE); clearPasswordFields(); } else { String dialogMessage = ATT_DEL_FAIL_1.getContent() + System.lineSeparator() + ATT_CANT_DEL_2.getContent() + userIDText.getText(); JOptionPane.showMessageDialog(this, dialogMessage, DELETE_RESULT_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE); } } catch (Exception se) { logParkingException(Level.SEVERE, se, "(ID: " + deleteID + ")"); } finally { closeDBstuff(conn, updateStmt, null, "(ID: " + deleteID + ")"); } }
From source file:neembuu.uploader.NeembuuUploader.java
/** * This displays a small dialog for user to choose the language from a set * of available options/* ww w . j a v a 2 s .c o m*/ */ static void displayLanguageOptionDialog() { NeembuuUploaderLanguages.refresh(); //This code returns the selected language if and only if the user selects the Ok button ThemeCheck.apply(null); String selectedlanguage = (String) JOptionPane.showInputDialog(NeembuuUploader.getInstance(), "Choose your language: ", "Language", JOptionPane.PLAIN_MESSAGE, null, NeembuuUploaderLanguages.getLanguageNames(), NeembuuUploaderLanguages.getUserLanguageName()); //selectedlanguage will be null if the user clicks the cancel or close button //so check for that. if (selectedlanguage != null) { //Set the language to settings file NeembuuUploaderLanguages.setUserLanguageByName(selectedlanguage); //Change the GUI to new language. Translation.changeLanguage(NeembuuUploaderLanguages.getUserLanguageCode()); } }
From source file:com.osparking.attendant.AttListForm.java
private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed try {//from w w w .j a va 2s . co m List sortKeys = usersTable.getRowSorter().getSortKeys(); if (loadAttendantTable("") == 0) { clearDetailsForEmptyList(); // Inform user that no user found. JOptionPane.showConfirmDialog(this, NO_USER_DIALOG.getContent(), SEARCH_RESULT_TITLE.getContent(), JOptionPane.PLAIN_MESSAGE, INFORMATION_MESSAGE); } else { usersTable.changeSelection(0, 0, false, false); } usersTable.requestFocus(); usersTable.getRowSorter().setSortKeys(sortKeys); if (usersTable.getRowCount() == 0) { multiFuncButton.setEnabled(false); deleteButton.setEnabled(false); } else { int selRow = usersTable.getSelectedRow(); changeFieldButtonUsability(selRow); } } catch (Exception ex) { logParkingException(Level.SEVERE, ex, "(User action: user list search)"); } }
From source file:com.osparking.attendant.AttListForm.java
private void checkEmailButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkEmailButtonActionPerformed // Check syntax first, and then check if it's preoccupied, if everything were OK, then use the e-mail. // Otherwise, just return // Use avax.mail.jar library. // Refer http://examples.javacodegeeks.com/enterprise-java/mail/validate-email-address-with-java-mail-api/ // Download: https://java.net/projects/javamail/pages/Home#Download_JavaMail_1.5.2_Release String emailEntered = emailAddrText.getText().trim(); try {/*from ww w . j a va2 s . co m*/ boolean checkResult = validateEmail(emailEntered); if (checkResult) { String sql = "Select count(*) as dataCount From users_osp Where email = ?"; if (dataExistsInDB(sql, emailEntered)) { // Access DB and find if entered e-mail is already registered to the system. String dialogMessage = ATT_EMAIL_TAKEN_1.getContent() + emailAddrText.getText().trim() + ATT_EMAIL_TAKEN_2.getContent() + System.lineSeparator() + ATT_EMAIL_TAKEN_3.getContent(); JOptionPane.showConfirmDialog(this, dialogMessage, ATT_EMAIL_DUP_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE); emailAddrText.requestFocus(); } else { Email_usable = true; usableEmail = emailEntered; checkEmailButton.setEnabled(false); String dialogMessage = ATT_EMAIL_TAKEN_1.getContent() + emailAddrText.getText().trim() + ATT_EMAIL_GOOD_2.getContent(); JOptionPane.showConfirmDialog(this, dialogMessage, ATT_EMAIL_DUP_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE, INFORMATION_MESSAGE); } } else { String dialogMessage = EMAIL_SYNTAX_1.getContent() + emailAddrText.getText().trim() + EMAIL_SYNTAX_2.getContent(); JOptionPane.showConfirmDialog(this, dialogMessage, ATT_EMAIL_SYNTAX_CHECK_DIALOG.getContent(), JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE); emailAddrText.requestFocus(); } } catch (Exception ex) { logParkingException(Level.SEVERE, ex, "(User action: new E-mail address('" + emailEntered + "') check button)"); } }