List of usage examples for javax.swing JOptionPane INFORMATION_MESSAGE
int INFORMATION_MESSAGE
To view the source code for javax.swing JOptionPane INFORMATION_MESSAGE.
Click Source Link
From source file:net.sf.jabref.sql.exporter.DatabaseExporter.java
private String getDBName(Vector<Vector<String>> matrix, DBStrings databaseStrings, JabRefFrame frame, DBImportExportDialog dialogo) throws Exception { String dbName = ""; if (matrix.size() > 1) { if (dialogo.hasDBSelected) { dbName = dialogo.selectedDB; if ((dialogo.selectedInt == 0) && (!dialogo.removeAction)) { dbName = JOptionPane.showInputDialog(dialogo.getDiag(), Localization.lang("Please enter the desired name:"), Localization.lang("SQL Export"), JOptionPane.INFORMATION_MESSAGE); if (dbName == null) { getDBName(matrix, databaseStrings, frame, new DBImportExportDialog(frame, matrix, DBImportExportDialog.DialogType.EXPORTER)); } else { while (!isValidDBName(dbNames, dbName)) { dbName = JOptionPane.showInputDialog(dialogo.getDiag(), Localization.lang("You have entered an invalid or already existent DB name.") + '\n' + Localization.lang("Please enter the desired name:"), Localization.lang("SQL Export"), JOptionPane.ERROR_MESSAGE); }//w w w . ja v a 2 s . c om } } } } else { dbName = JOptionPane.showInputDialog(frame, Localization.lang("Please enter the desired name:"), Localization.lang("SQL Export"), JOptionPane.INFORMATION_MESSAGE); } return dbName; }
From source file:com.proyecto.vista.MantenimientoPeriodo.java
private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed // TODO add your handling code here: accion = Controlador.ELIMINAR;/*from w w w . ja va 2s . co m*/ if (tblperiodo.getSelectedRow() != -1) { Integer codigo = tblperiodo.getSelectedRow(); Periodo periodo = periodoControlador.buscarPorId(lista.get(codigo).getId()); if (periodo != null) { if (JOptionPane.showConfirmDialog(null, "Desea Eliminar el Periodo?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { int[] filas = tblperiodo.getSelectedRows(); for (int i = 0; i < filas.length; i++) { Periodo periodo2 = lista.get(filas[0]); lista.remove(periodo2); periodoControlador.setSeleccionado(periodo2); periodoControlador.accion(accion); } if (periodoControlador.accion(accion) == 3) { JOptionPane.showMessageDialog(null, "Periodo eliminado correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(null, "Periodo no eliminada", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Periodo no eliminada", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } } else { JOptionPane.showMessageDialog(null, "Debe seleccionar un Periodo", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } }
From source file:jatoo.app.App.java
/** * Displays an information message./* www .j a v a2 s .c o m*/ * * @param message * the message to display */ public void showInformationMessage(final String message) { JOptionPane.showMessageDialog(window, message, getTitle(), JOptionPane.INFORMATION_MESSAGE); }
From source file:UserInterface.ViewPersonDetails.java
private void btnviewPatientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnviewPatientActionPerformed // TODO add your handling code here: p = (Person) cmbPerson.getSelectedItem(); if (p.getPatient().getName() == null) { JOptionPane.showMessageDialog(null, "Create patient profile", "Information", JOptionPane.INFORMATION_MESSAGE); } else {/* w w w .j a v a 2 s . c o m*/ txtpatientID.setText(p.getPatient().getID()); txtpatientName.setText(p.getPatient().getName()); txtpatientAge.setText(String.valueOf(p.getPatient().getAge())); txtgender.setText(p.getPatient().getGender()); txtdoctorName.setText(p.getPatient().getDoctorName()); } }
From source file:com.biosis.biosislite.vistas.inventario.MantenimientoCampo.java
private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed // TODO add your handling code here: accion = AbstractControlador.ELIMINAR; if (tblclase.getSelectedRow() != -1) { Integer id = tblclase.getSelectedRow(); Campo campo = campoControlador.buscarPorId(lista.get(id).getId()); if (campo != null) { if (JOptionPane.showConfirmDialog(null, "Desea Eliminar el Campo?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { int[] filas = tblclase.getSelectedRows(); for (int i = 0; i < filas.length; i++) { Campo campo2 = lista.get(filas[0]); lista.remove(campo2); campoControlador.setSeleccionado(campo2); campoControlador.accion(accion); }/* w ww . j a v a 2s. co m*/ if (campoControlador.accion(accion) == 3) { JOptionPane.showMessageDialog(null, "Campo eliminada correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(null, "Campo no eliminada", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Campo no eliminada", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } } else { JOptionPane.showMessageDialog(null, "Debe seleccionar un Campo de la lista", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } }
From source file:com.xmage.launcher.XMageLauncher.java
private void checkJava() { try {/* ww w. ja v a 2 s . c o m*/ String javaAvailableVersion = (String) config.getJSONObject("java").get(("version")); String javaInstalledVersion = Config.getInstalledJavaVersion(); textArea.append(messages.getString("java.installed") + javaInstalledVersion + "\n"); textArea.append(messages.getString("java.available") + javaAvailableVersion + "\n"); noJava = false; newJava = false; if (!javaAvailableVersion.equals(javaInstalledVersion)) { newJava = true; String javaMessage = ""; String javaTitle = ""; if (javaInstalledVersion.isEmpty()) { noJava = true; textArea.append(messages.getString("java.none") + "\n"); javaMessage = messages.getString("java.none.message"); javaTitle = messages.getString("java.none"); } else { textArea.append(messages.getString("java.new") + "\n"); javaMessage = messages.getString("java.new.message"); javaTitle = messages.getString("java.new"); } JOptionPane.showMessageDialog(frame, javaMessage, javaTitle, JOptionPane.INFORMATION_MESSAGE); } } catch (JSONException ex) { logger.error("Error: ", ex); } }
From source file:UserInterface.PatientRole.ManageMyVitalSignsAndFitnessRecordJPanel.java
private void createChart() { DefaultCategoryDataset vitalSignDataset = new DefaultCategoryDataset(); int selectedRow = viewVitalSignsJTable1.getSelectedRow(); ArrayList<Record> recordList = patient.getRecordHistory().getRecordList(); /*At least 2 vital sign records needed to show chart */ if (recordList.isEmpty() || recordList.size() == 1) { JOptionPane.showMessageDialog(this, "No Fitness Record or only one fitness record found. At least 2 fitness records needed to show chart!", "Warning", JOptionPane.INFORMATION_MESSAGE); return;//from www . ja v a 2 s. c o m } for (Record record : recordList) { vitalSignDataset.addValue(record.getStandTime(), "StandTime", record.getDate()); vitalSignDataset.addValue(record.getMoveTime(), "MoveTime", record.getDate()); vitalSignDataset.addValue(record.getExcerciseTime(), "ExcerciseTime", record.getDate()); vitalSignDataset.addValue(record.getTotalTime(), "TotalTime", record.getDate()); } JFreeChart vitalSignChart = ChartFactory.createBarChart3D("Fitness Record Chart", "Time Stamp", "Time(mins)", vitalSignDataset, PlotOrientation.VERTICAL, true, false, false); vitalSignChart.setBackgroundPaint(Color.white); CategoryPlot vitalSignChartPlot = vitalSignChart.getCategoryPlot(); vitalSignChartPlot.setBackgroundPaint(Color.lightGray); CategoryAxis vitalSignDomainAxis = vitalSignChartPlot.getDomainAxis(); vitalSignDomainAxis .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); NumberAxis vitalSignRangeAxis = (NumberAxis) vitalSignChartPlot.getRangeAxis(); vitalSignRangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartFrame chartFrame = new ChartFrame("Chart", vitalSignChart); chartFrame.setVisible(true); chartFrame.setSize(500, 500); }
From source file:edu.ku.brc.specify.ui.treetables.TreeDefinitionEditor.java
/** * @param index index of item to edit/* w w w .java 2 s . co m*/ */ @SuppressWarnings("unchecked") //$NON-NLS-1$ protected void editTreeDefItem(final int index) { if (index == -1 || !isEditMode) { return; } log.info("Edit row " + index); //$NON-NLS-1$ // load a fresh copy of the item from the DB I uiDefItem = tableModel.get(index); DataProviderSessionIFace tmpSession = DataProviderFactory.getInstance().createSession(); final I defItem = (I) tmpSession.load(uiDefItem.getClass(), uiDefItem.getTreeDefItemId()); log.info("loaded defItem for editing"); if (defItem == null) { statusBar.setErrorMessage( "The tree def has been changed by another user. The def editor must be reloaded."); //$NON-NLS-1$ SwingUtilities.invokeLater(new Runnable() { public void run() { log.info("initializing tree editor"); //$NON-NLS-1$ UIRegistry.writeGlassPaneMsg(getResourceString("TTV_Loading"), 24); //$NON-NLS-1$ initTreeDefEditorComponent(displayedDef); log.info("initialized tree editor"); repaint(); UIRegistry.clearGlassPaneMsg(); log.info("invoking selectionValueChanged()"); selectionValueChanged(); } }); tmpSession.close(); return; } tmpSession.close(); defItem.setDisplayText(defItem.getDisplayText()); // keep track of what these values are before the edits happen final I beforeItem = (I) TreeFactory.createNewTreeDefItem(defItem.getClass(), null, null); log.info("created beforeItem"); //$NON-NLS-1$ beforeItem.setIsInFullName(boolVal(defItem.getIsInFullName(), false)); beforeItem.setTextBefore(defItem.getTextBefore()); beforeItem.setTextAfter(defItem.getTextAfter()); beforeItem.setFullNameSeparator(defItem.getFullNameSeparator()); beforeItem.setIsEnforced(boolVal(defItem.getIsEnforced(), false)); // TODO: double check these choices // gather all the info needed to create a form in a dialog String viewName = TreeFactory.getAppropriateViewName(defItem); Frame parentFrame = (Frame) UIRegistry.get(UIRegistry.FRAME); String displayName = "NODE_EDIT_DISPLAY_NAME"; //$NON-NLS-1$ boolean isEdit = true; String closeBtnText = (isEdit) ? getResourceString("SAVE") : getResourceString("CLOSE"); //$NON-NLS-1$ //$NON-NLS-2$ String className = defItem.getClass().getName(); DBTableInfo nodeTableInfo = DBTableIdMgr.getInstance() .getInfoById(((DataModelObjBase) defItem).getTableId()); String idFieldName = nodeTableInfo.getIdFieldName(); int options = MultiView.HIDE_SAVE_BTN; // create the form dialog String title = getResourceString("TreeRankEditDialogTitle"); //$NON-NLS-1$ log.info("creating dialog"); //$NON-NLS-1$ ViewBasedDisplayDialog dialog = new ViewBasedDisplayDialog(parentFrame, null, viewName, displayName, title, closeBtnText, className, idFieldName, isEdit, options); log.info("created dialog"); //$NON-NLS-1$ dialog.setModal(true); dialog.setData(defItem); dialog.preCreateUI(); dialog.setVisible(true); // the dialog has been dismissed by the user if (dialog.getBtnPressed() == ViewBasedDisplayIFace.OK_BTN) { UIRegistry.writeGlassPaneMsg(getResourceString("TTV_Saving"), 24); //$NON-NLS-1$ SwingWorker bgThread = new SwingWorker() { boolean success; I mergedItem; @SuppressWarnings("synthetic-access") //$NON-NLS-1$ //$NON-NLS-2$ @Override public Object construct() { // determine if the change can be made without requiring tree node changes if (needToRebuildFullNames(beforeItem, defItem)) //May not be too hard to just pass the nodesToChange for full name updates... //List<String> nodesToChange = getNodesThatMustBeFixedBeforeEdit(beforeItem, defItem); //if (nodesToChange != null && nodesToChange.size() > 0) { if (!UIRegistry.displayConfirmLocalized(UIRegistry.getResourceString("Confirm"), "TDE_ChangesRequireFullNameUpdate", "OK", "Cancel", JOptionPane.INFORMATION_MESSAGE)) { return false; } } // save the node and update the tree viewer appropriately DataProviderSessionIFace session = DataProviderFactory.getInstance().createSession(); try { mergedItem = session.merge(defItem); } catch (StaleObjectException e1) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(TreeDefinitionEditor.class, e1); // another user or process has changed the data "underneath" us UIRegistry.showLocalizedError("UPDATE_DATA_STALE"); //$NON-NLS-1$ if (session != null) { session.close(); } session = DataProviderFactory.getInstance().createSession(); mergedItem = (I) session.load(defItem.getClass(), defItem.getTreeDefItemId()); success = false; return success; } success = true; if (businessRules != null) { businessRules.beforeSave(mergedItem, session); } try { session.beginTransaction(); session.saveOrUpdate(mergedItem); if (businessRules != null) { if (!businessRules.beforeSaveCommit(mergedItem, session)) { throw new Exception("Business rules processing failed"); //$NON-NLS-1$ } } session.commit(); notifyApplication(mergedItem, EDITED_ITEM); log.info("Successfully saved changes to " + mergedItem.getName()); //$NON-NLS-1$ // at this point, the new node is in the DB (if success == true) if (businessRules != null && success == true) { businessRules.afterSaveCommit(defItem, session); } } catch (Exception e) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(TreeDefinitionEditor.class, e); success = false; UIRegistry.showLocalizedError("UNRECOVERABLE_DB_ERROR"); //$NON-NLS-1$ log.error("Error while saving node changes. Rolling back transaction.", e); //$NON-NLS-1$ session.rollback(); } finally { session.close(); } return success; } @Override public void finished() { // now refresh the tree viewer if (success) { if (needToRebuildFullNames(beforeItem, defItem)) { try { displayedDef.updateAllFullNames(null, true, true, defItem.getRankId()); } catch (Exception ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance() .capture(TreeDefinitionEditor.class, ex); UIRegistry.showLocalizedError("UNRECOVERABLE_DB_ERROR"); //$NON-NLS-1$ log.error( "Error while updating full names. Full names may not correspond to tree definition.", //$NON-NLS-1$ ex); } } tableModel.set(index, mergedItem); } UIRegistry.clearGlassPaneMsg(); } }; bgThread.start(); } else { // the user didn't save any edits (if there were any) } }
From source file:dialog.DialogFunctionRoom.java
private void btnFunctionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFunctionActionPerformed String roomName = tfRoomName.getText(); if (roomName.isEmpty()) { JOptionPane.showMessageDialog(null, "Tn phng khng c trng", "Error", JOptionPane.ERROR_MESSAGE); tfRoomName.requestFocus();/*from w w w. jav a2 s . c om*/ return; } String priceString = tfPrice.getText(); if (priceString.isEmpty()) { JOptionPane.showMessageDialog(null, "Gi phng khng c trng", "Error", JOptionPane.ERROR_MESSAGE); tfPrice.requestFocus(); return; } double price; try { price = Double.parseDouble(priceString); } catch (NumberFormatException nfe) { JOptionPane.showMessageDialog(null, "Gi phng khng ng nh dng", "Error", JOptionPane.ERROR_MESSAGE); return; } int max; try { max = Integer.parseInt(priceString); } catch (NumberFormatException nfe) { JOptionPane.showMessageDialog(null, "Gi phng khng ng nh dng", "Error", JOptionPane.ERROR_MESSAGE); return; } Floor objFloor = (Floor) cbFloor.getSelectedItem(); int roomType = cbRoomType.getSelectedIndex() + 1; ModelPicture modelPicture = new ModelPicture(); if (mType == Constant.TYPE_ADD) { if (mControllerRoom == null) { actionAddNoController(); return; } String idRoom = UUID.randomUUID().toString(); if (!mControllerRoom.isExistRoomInFloor(roomName, objFloor.getIdFloor())) { mListUriPhotos.stream().forEach((uriPicture) -> { File file = new File(uriPicture); String fileName = FilenameUtils.getBaseName(file.getName()) + "-" + System.nanoTime() + "." + FilenameUtils.getExtension(file.getName()); Path source = Paths.get(uriPicture); Path destination = Paths.get("files/" + fileName); try { Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING); } catch (IOException ex) { Logger.getLogger(DialogFunctionRoom.class.getName()).log(Level.SEVERE, null, ex); } Picture objPicture = new Picture(UUID.randomUUID().toString(), idRoom, fileName); modelPicture.addItem(objPicture); mListPictures.add(objPicture); }); Room objRoom = new Room(idRoom, objFloor.getIdFloor(), roomName, roomType, price, Constant.ROOM_CONDITION_AVAILABLE_TYPE, mListPictures, null, objFloor.getFloorName(), max); mObjRoom = objRoom; if (mControllerRoom.addItem(objRoom)) { objFloor.setMaxRoom(objFloor.getMaxRoom() + 1); new ModelFloor().editItem(objFloor); ImageIcon icon = new ImageIcon(getClass().getResource("/images/ic_success.png").getPath()); JOptionPane.showMessageDialog(this, "Thm thnh cng!", "Success", JOptionPane.INFORMATION_MESSAGE, icon); this.dispose(); } } else { JOptionPane.showMessageDialog(this, "Phng tn ti!", "Error", JOptionPane.ERROR_MESSAGE); } } else if (mType == Constant.TYPE_EDIT) { mObjRoom.setFloorName(objFloor.getFloorName()); mObjRoom.setRoomName(roomName); mObjRoom.setPrice(price); mObjRoom.setIdFloor(objFloor.getIdFloor()); mObjRoom.setMax(max); mObjRoom.setType(cbRoomType.getSelectedIndex() + 1); mListUriPhotos.stream().forEach((uriPicture) -> { File file = new File(uriPicture); String fileName = FilenameUtils.getBaseName(file.getName()) + "-" + System.nanoTime() + "." + FilenameUtils.getExtension(file.getName()); Path source = Paths.get(uriPicture); Path destination = Paths.get("files/" + fileName); try { Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING); } catch (IOException ex) { Logger.getLogger(DialogFunctionRoom.class.getName()).log(Level.SEVERE, null, ex); } Picture objPicture = new Picture(UUID.randomUUID().toString(), mObjRoom.getIdRoom(), fileName); modelPicture.addItem(objPicture); mListPictures.add(objPicture); }); mObjRoom.setListPicture(mListPictures); if (mControllerRoom.editItem(mObjRoom, mRow)) { ImageIcon icon = new ImageIcon(getClass().getResource("/images/ic_success.png").getPath()); JOptionPane.showMessageDialog(this, "Sa thnh cng!", "Success", JOptionPane.INFORMATION_MESSAGE, icon); this.dispose(); } } }
From source file:com.proyecto.vista.MantenimientoArea.java
private void btnguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarActionPerformed // TODO add your handling code here: List<Integer> array = new ArrayList(); array.add(FormularioUtil.Validar(FormularioUtil.TipoValidacion.NUMERO, this.nombreField, "Nombre")); FormularioUtil.validar2(array);//from ww w . ja va 2 s .c om if (FormularioUtil.error) { JOptionPane.showMessageDialog(null, FormularioUtil.mensaje, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); FormularioUtil.mensaje = ""; FormularioUtil.error = false; } else { String palabra = ""; String palabra2 = ""; if (accion == 1) { palabra = "registrar"; palabra2 = "registrado"; if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " la Area?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { areaControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase()); areaControlador.accion(accion); lista.add(areaControlador.getSeleccionado()); if (accion == 1) { JOptionPane.showMessageDialog(null, "Area " + palabra2 + " correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); FormularioUtil.limpiarComponente(panelDatos); } else { JOptionPane.showMessageDialog(null, "Area no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { FormularioUtil.limpiarComponente(panelDatos); JOptionPane.showMessageDialog(null, "Area no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else if (accion == 2) { palabra = "modificar"; palabra2 = "modificado"; if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " la Area?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { if (accion == 2) { JOptionPane.showMessageDialog(null, "Area " + palabra2 + " correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); lista.clear(); areaControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase()); areaControlador.accion(accion); listar(); FormularioUtil.limpiarComponente(panelDatos); } else { JOptionPane.showMessageDialog(null, "Area no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { FormularioUtil.limpiarComponente(panelDatos); JOptionPane.showMessageDialog(null, "Area no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } FormularioUtil.activarComponente(panelOpciones, true); FormularioUtil.activarComponente(panelGuardar, false); FormularioUtil.activarComponente(panelDatos, false); } }