List of usage examples for javax.swing JOptionPane WARNING_MESSAGE
int WARNING_MESSAGE
To view the source code for javax.swing JOptionPane WARNING_MESSAGE.
Click Source Link
From source file:com.archivas.clienttools.arcmover.gui.panels.ProfilePanel.java
public final void renameSelectedRow() { try {//from w w w . j a v a 2s.co m if (getSelectedRowCount() != 1) { JOptionPane.showMessageDialog(this, "You may only rename one object at a time", "", JOptionPane.INFORMATION_MESSAGE); return; } // show rename dialog String newFileName; String oldFileName = selectedFile.getFileName(); // The slugs are stand-ins for file type in messages final String lSlug = (selectedFile.isDirectory() ? "directory" : "file"); final String uSlug = (selectedFile.isDirectory() ? "Directory" : "File"); do { final String message = String.format("New %s name", lSlug); final String title = String.format("Rename %s", uSlug); // get new file name from user newFileName = (String) JOptionPane.showInputDialog(this.getParent(), message, title, JOptionPane.QUESTION_MESSAGE, null, null, selectedFile.getFileName()); // check if user pressed 'cancel' button if (newFileName == null) { LOG.info("Rename operation canceled"); return; } // validate the new file name // TODO: Complete validation based on target OS is not performed at this time. If // needed, that should be added here. if (newFileName.contains("/") || newFileName.contains("\\")) { final String errorMessage = String.format("Invalid %s name", lSlug); JOptionPane.showMessageDialog(this.getParent(), errorMessage, "Rename", JOptionPane.WARNING_MESSAGE); newFileName = null; } } while ((newFileName == null) || (newFileName.length() <= 0)); try { boolean success; success = arcMoverEngine.renameTo(profileModel.getSelectedProfile(), selectedFile.getParent().getPath(), oldFileName, newFileName); if (!success) { throw new IOException(String.format("Could not rename %s.", lSlug)); } LOG.info("Renamed " + oldFileName + " to " + newFileName); HCPDataMigrator.getInstance().refreshMatchingPanels(profileModel.getSelectedProfile(), currentDir); } catch (Exception e1) { String uiErrorMsg; String logErrorMsg; logErrorMsg = "Could not rename " + selectedFile.getPath() + " to " + newFileName; uiErrorMsg = DBUtils.getErrorMessage("Error renaming " + selectedFile.getPath(), e1); LOG.log(Level.WARNING, logErrorMsg, e1); GUIHelper.showMessageDialog(this.getParent(), uiErrorMsg, "Rename", JOptionPane.ERROR_MESSAGE); } } catch (RuntimeException e1) { // TODO: Implement Proper Error Handling LOG.log(Level.WARNING, "Unexpected Exception", e1); throw e1; } }
From source file:fitnesserefactor.FitnesseRefactor.java
private void ReplaceAllBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ReplaceAllBtnActionPerformed if (ParentFolder1.isSelected()) { if (!"".equals(JtreePath)) { File dir = new File(JtreePath); try { if (dir.getParent() != null && dir.isFile()) { String Testcase = dir.getParent(); File dir1 = new File(Testcase); if (dir1.getParent() != null && dir1.isDirectory()) { String parent = dir1.getParent(); File dir2 = new File(Testcase); if (dir2.getParent() != null) { String GrandParent = dir2.getParent(); File dir3 = new File(GrandParent); File[] allFiles = dir3.listFiles(); ArrayList al = new ArrayList(); for (File file : allFiles) { String TestcaseNames = file.getName(); al.add(TestcaseNames); }/*from ww w.j a va 2s. co m*/ if (!fromTxt.getText().isEmpty() && !toTxt.getText().isEmpty()) { int FromTxtInt = Integer.parseInt(fromTxt.getText()); int ToTxtInt = Integer.parseInt(toTxt.getText()); int TotFiles = al.size(); if ((ToTxtInt > FromTxtInt) && (ToTxtInt > 0) && (FromTxtInt > 0) && ToTxtInt <= al.size() - 2) { for (int removeAfterToIndx = (ToTxtInt + 2); removeAfterToIndx < TotFiles; removeAfterToIndx++) { al.remove(ToTxtInt + 2); } if (FromTxtInt > 1) { for (int removeFromIndx = 1; removeFromIndx < FromTxtInt; removeFromIndx++) { al.remove(2); } } } else { JOptionPane.showMessageDialog(null, "FROM test case number cannot be greater/equal to TO test case number.\nFROM and TO test case numbers should be greater than zero. \nTO test case number should not be greater than the testcase count ", "Warning", JOptionPane.WARNING_MESSAGE); } } for (int i = 2; i <= al.size(); i++) { System.out.println(dir2.getParent() + "\\" + al.get(i) + "\\content.txt"); File EachFile = new File(dir2.getParent() + "\\" + al.get(i) + "\\content.txt"); for (int j = 0; j < FileUtils.readLines(EachFile).size(); j++) { String line = (String) FileUtils.readLines(EachFile).get(j); if (line.matches("(.*)" + FitnesseTablesList.getSelectedItem().toString() + "(.*)")) { p = j; ReplacedLines = new ArrayList(); ReadAllLines(EachFile); getTable(EachFile); int SelectedTable = getTable(EachFile).size(); for (int RepLines = 0; RepLines < SelectedTable; RepLines++) { ReplaceValue(EachFile, getTable(EachFile).get(RepLines).toString()); } int c = 0; for (int Replace = p; Replace < SelectedTable + p; Replace++) { AllLines.set(Replace, ReplacedLines.get(c)); c++; } WriteAllLines(EachFile); } } } } else { JOptionPane.showMessageDialog(null, "There are no testcases under the parent folder", "Error", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "There are no testcases under the parent folder", "Error", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Need to select atleast one content.txt file", "Warning", JOptionPane.WARNING_MESSAGE); } } catch (Exception E) { //JOptionPane.showMessageDialog(null, E, "Java Runtime Error", JOptionPane.ERROR ); } } } }
From source file:com.dfki.av.sudplan.ui.MainFrame.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(EventHolder.LAYERINFO_RETREIVAL_COMPLETE)) { pbWMS.setIndeterminate(false);//from www . j av a2s . c o m pbWMS.setVisible(false); cLayerList.removeAllItems(); if (evt.getNewValue() instanceof List<?>) { for (LayerInfo layerInfo : (List<LayerInfo>) evt.getNewValue()) { cLayerList.addItem(layerInfo); } } else if (evt.getNewValue() instanceof LayerInfo) { cLayerList.addItem((LayerInfo) evt.getNewValue()); } else { log.error("Wrong event value (not instanceof LayerInfo or List<LayerInfo>)"); } cLayerList.setEnabled(true); bAddWMSHeight.setEnabled(true); bGoWMSHeight.setEnabled(true); } if (evt.getPropertyName().equals(EventHolder.LAYERINFO_RETREIVAL_FAILED)) { resetWMSHeightDialog(); JOptionPane.showMessageDialog(dWMSHeight, "Could not retreive WMS data from server.", "WMS-Server Error", JOptionPane.WARNING_MESSAGE); } }
From source file:mondrian.gui.Workbench.java
/** * Validates that the schema can be parsed and loaded, * showing a warning message if any errors are encountered. *///from w w w. j av a 2 s. c om private boolean isSchemaValid(MondrianGuiDef.Schema schema) { try { StringWriter writer = new StringWriter(); XMLOutput xmlOutput = new XMLOutput(writer); schema.displayXML(xmlOutput); Parser xmlParser = XOMUtil.createDefaultParser(); Reader reader = new StringReader(writer.getBuffer().toString()); // attempt to create a new schema new MondrianGuiDef.Schema(xmlParser.parse(reader)); } catch (XOMException e) { JOptionPane.showMessageDialog(this, getResourceConverter().getFormattedString("workbench.save.invalid.schema", "Please correct the following error before saving:", e.getLocalizedMessage()), getResourceConverter().getFormattedString("workbench.save.invalid.schema.title", "Cannot Save"), JOptionPane.WARNING_MESSAGE); return false; } return true; }
From source file:userInterface.HospitalAdminRole.ManagePatientsJPanel.java
private void submitVisitStatusBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitVisitStatusBtnActionPerformed Enumeration<AbstractButton> bg = visitBtnGrp.getElements(); while (bg.hasMoreElements()) { JRadioButton jrd = (JRadioButton) bg.nextElement(); int selectedRow = vitalSignAlertsTable.getSelectedRow(); Date currentDate = new Date(); HosptoHouseWorkRequest request = (HosptoHouseWorkRequest) vitalSignAlertsTable.getValueAt(selectedRow, 0);/*from w w w .j a v a 2 s . c o m*/ if (jrd.isSelected()) { if (selectedRow >= 0) { if (request.getAppointmentDate() != null) { if (jrd.getText().equals("Visited")) { if (!request.getStatus().equals("Cancelled")) { if (request.getAppointmentDate().compareTo(currentDate) < 0) { if (request.getStatus().equals("Confirmed")) { request.setStatus("Visited"); populateAlertFamilyTable(); } else if (request.getStatus().equals("Cancelled")) { JOptionPane.showMessageDialog(null, "Appointment is already cancelled", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } else if (request.getStatus().equals("Dint Show Up")) { JOptionPane.showMessageDialog(null, "Person dint show up.", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Check after the appointment time", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); return; } } else { JOptionPane.showMessageDialog(null, "Appointment is already cancelled", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else if (jrd.getText().equals("Dint Show Up")) { // HosptoHouseWorkRequest request = (HosptoHouseWorkRequest)vitalSignAlertsTable.getValueAt(selectedRow, 0); if (!request.getStatus().equals("Cancelled")) { if (request.getAppointmentDate().compareTo(currentDate) < 0) { if (request.getStatus().equals("Confirmed")) { request.setStatus("Dint Show Up"); populateAlertFamilyTable(); } else if (request.getStatus().equals("Visited")) { JOptionPane.showMessageDialog(null, "Person already visited.", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Check after the appointment time", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Appointment is already cancelled", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else if (jrd.getText().equals("Cancel")) { // HosptoHouseWorkRequest request = (HosptoHouseWorkRequest)vitalSignAlertsTable.getValueAt(selectedRow, 0); if (!request.getStatus().equals("Cancelled")) { if (request.getAppointmentDate().compareTo(currentDate) > 0) { if (request.getStatus().equals("Confirmed")) { request.setStatus("Cancelled"); populateAlertFamilyTable(); } else { request.setStatus("Cancelled"); populateAlertFamilyTable(); } } else { JOptionPane.showMessageDialog(null, "Can be cancelled before appointment time", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Appointment is already cancelled", "WARNING", JOptionPane.WARNING_MESSAGE); } } } else { JOptionPane.showMessageDialog(null, "Appointment not requested", "MESSAGE", JOptionPane.INFORMATION_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Kindly select a row!", "WARNING", JOptionPane.WARNING_MESSAGE); } } } }
From source file:de.dmarcini.submatix.pclogger.gui.spx42LogGraphPanel.java
/** * Zeigt eine Warnung an Project: SubmatixBTConfigPC Package: de.dmarcini.submatix.pclogger.gui * /*from w ww . j a va2s . com*/ * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 07.01.2012 * @param msg * Warnmessage */ private void showWarnBox(String msg) { ImageIcon icon = null; try { icon = new ImageIcon(MainCommGUI.class.getResource("/de/dmarcini/submatix/pclogger/res/Abort.png")); JOptionPane.showMessageDialog(this, msg, LangStrings.getString("MainCommGUI.warnDialog.headline"), JOptionPane.WARNING_MESSAGE, icon); } catch (NullPointerException ex) { lg.error("ERROR showWarnDialog <" + ex.getMessage() + "> ABORT!"); return; } catch (MissingResourceException ex) { lg.error("ERROR showWarnDialog <" + ex.getMessage() + "> ABORT!"); return; } catch (ClassCastException ex) { lg.error("ERROR showWarnDialog <" + ex.getMessage() + "> ABORT!"); return; } }
From source file:course_generator.frmMain.java
/** * Define a new starting point from the current position in the main table *///from ww w . ja v a 2 s .co m protected void NewStartPoint() { if (Track.data.isEmpty()) return; int start = TableMain.getSelectedRow(); if (start < 0) return; //-- Confirmation dialog Object[] options = { " " + bundle.getString("frmMain.NewStartYes") + " ", " " + bundle.getString("frmMain.NewStartNo") + " " }; int ret = JOptionPane.showOptionDialog(this, bundle.getString("frmMain.NewStartMessage"), bundle.getString("frmMain.NewStartTitle"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]); //-- Ok! Let's go if (ret == JOptionPane.YES_OPTION) { Track.NewStartingPoint(start); //-- Move the cursor to the first line of the data table TableMain.setRowSelectionInterval(0, 0); Rectangle rect = TableMain.getCellRect(0, 0, true); TableMain.scrollRectToVisible(rect); Track.isCalculated = false; Track.isModified = true; //-- Refresh RefreshStatusbar(Track); RefreshTableMain(); RefreshResume(); RefreshStat(false); //Refresh the marker position on the map RefreshCurrentPosMarker(Track.data.get(0).getLatitude(), Track.data.get(0).getLongitude()); } }
From source file:es.darkhogg.hazelnutt.EditorFrame.java
private void actionImportLevel() { int res = hlfFileChooser.showOpenDialog(this); if (res == JFileChooser.APPROVE_OPTION) { File file = hlfFileChooser.getSelectedFile(); try {/* w ww. j av a 2s . c o m*/ Level level = HazelnuttLevelFormat.getInstance().loadLevelFromFile(file); int currArea = selectedLevel.getRomLevel().getSize().getX() * selectedLevel.getRomLevel().getSize().getY(); int newArea = level.getRomLevel().getSize().getX() * level.getRomLevel().getSize().getY(); if (currArea != newArea) { JOptionPane.showMessageDialog(this, "The currently selected level and the level you are " + "trying to import have different areas and are " + "not compatible\n" + "\nCurrent Level Area: " + currArea + "\nImported Level Area: " + newArea, "Error", JOptionPane.WARNING_MESSAGE); } else { selectLevel(level); levelHasChanged = true; } } catch (Exception e) { logger.info("Error loading the file: '" + file + "'"); e.printStackTrace(); JOptionPane.showMessageDialog(this, "An error ocurred while loading the file\n\n" + "File: " + loadedFile + "\n" + "Error: " + e, "Error", JOptionPane.ERROR_MESSAGE); } } }
From source file:de.bwravencl.controllerbuddy.gui.Main.java
private void loadProfile(final File file) { stopAll();/*from w w w . ja v a 2s . co m*/ var profileLoaded = false; try { final var jsonString = Files.readString(file.toPath()); final var actionAdapter = new ActionTypeAdapter(); final var gson = new GsonBuilder().registerTypeAdapterFactory(new ModeAwareTypeAdapterFactory()) .registerTypeAdapter(IAction.class, actionAdapter).create(); try { final var profile = gson.fromJson(jsonString, Profile.class); final var unknownActionClasses = actionAdapter.getUnknownActionClasses(); if (!unknownActionClasses.isEmpty()) JOptionPane.showMessageDialog(frame, rb.getString("UNKNOWN_ACTION_TYPES_DIALOG_TEXT") + String.join("\n", unknownActionClasses), rb.getString("WARNING_DIALOG_TITLE"), JOptionPane.WARNING_MESSAGE); profileLoaded = input.setProfile(profile, input.getJid()); if (profileLoaded) { saveLastProfile(file); updateModesPanel(); updateOverlayPanel(); loadedProfile = file.getName(); setUnsavedChanges(false); setStatusBarText(rb.getString("STATUS_PROFILE_LOADED") + file.getAbsolutePath()); scheduleStatusBarText(rb.getString("STATUS_READY")); fileChooser.setSelectedFile(file); restartLast(); } } catch (final JsonParseException e) { log.log(Logger.Level.ERROR, e.getMessage(), e); } } catch (final IOException e) { log.log(Logger.Level.ERROR, e.getMessage(), e); } if (!profileLoaded) JOptionPane.showMessageDialog(frame, rb.getString("COULD_NOT_LOAD_PROFILE_DIALOG_TEXT"), rb.getString("ERROR_DIALOG_TITLE"), JOptionPane.ERROR_MESSAGE); }
From source file:net.sf.jsignpdf.SignPdfForm.java
/** * @see net.sf.jsignpdf.SignResultListener#signerFinishedEvent(Exception) *//* w w w.jav a 2 s . c om*/ public synchronized void signerFinishedEvent(Throwable e) { if (e instanceof SSLHandshakeException) { JOptionPane.showMessageDialog(this, RES.get("error.sslHandshakeException"), "Error", JOptionPane.WARNING_MESSAGE); } btnInfoClose.setEnabled(true); infoDialog.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); if (!btnInfoClose.hasFocus()) btnInfoClose.requestFocus(); if (autoclose) btnInfoCloseActionPerformed(null); }