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:net.sf.jabref.gui.JabRefFrame.java
private int showSaveDialog(String filename) { Object[] options = { Localization.lang("Save changes"), Localization.lang("Discard changes"), Localization.lang("Return to JabRef") }; return JOptionPane.showOptionDialog(JabRefFrame.this, Localization.lang("Database '%0' has changed.", filename), Localization.lang("Save before closing"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[2]); }
From source file:com.lfv.lanzius.server.LanziusServer.java
public void actionPerformed(ActionEvent e) { JMenuItem item = (JMenuItem) e.getSource(); // File menu/*w w w. ja v a 2 s. c o m*/ if (item == itemLoadConfig) { if (serverStartedDate == null) menuChoiceLoadConfiguration(); else JOptionPane.showMessageDialog(frame, "The server must be stopped before loading a new configuration!", "Info!", JOptionPane.INFORMATION_MESSAGE); } else if (item == itemLoadExercise) { if (isConfigLoaded && serverStartedDate != null) { menuChoiceLoadExercise(); panel.deselectAll(); } else JOptionPane.showMessageDialog(frame, "Unable to load exercise! Configuration is not loaded or server is not started!", "Error!", JOptionPane.ERROR_MESSAGE); } else if (item == itemExit) { if (Config.SERVER_EXIT_DIALOG) { if ((JOptionPane.showConfirmDialog(frame, "Are you sure you want to exit the server control panel?", "Exit?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION)) { if (serverStartedDate != null) { menuChoiceServerStop(true); } log.info("Bye!"); System.exit(0); } } else { if (serverStartedDate != null) { menuChoiceServerStop(true); } log.info("Bye!"); System.exit(0); } } // Server menu else if (item == itemServerStart) { if (isConfigLoaded) { if (serverStartedDate == null) { menuChoiceServerStart(); itemServerRestart.setEnabled(true); } else JOptionPane.showMessageDialog(frame, "The server is already started!", "Info!", JOptionPane.INFORMATION_MESSAGE); } else JOptionPane.showMessageDialog(frame, "Unable to start server! Configuration file has not been loaded!", "Error!", JOptionPane.ERROR_MESSAGE); } else if (item == itemServerStop) { if (isConfigLoaded) { if (serverStartedDate != null) { menuChoiceServerStop(false); itemServerRestart.setEnabled(false); } else JOptionPane.showMessageDialog(frame, "The server is already stopped!", "Info!", JOptionPane.INFORMATION_MESSAGE); } else JOptionPane.showMessageDialog(frame, "Unable to stop server! Configuration file has not been loaded!", "Error!", JOptionPane.ERROR_MESSAGE); } else if (item == itemServerRestart) { if (isConfigLoaded) { if (serverStartedDate != null) serverRestart(); else JOptionPane.showMessageDialog(frame, "The server is not running!", "Info!", JOptionPane.INFORMATION_MESSAGE); } else JOptionPane.showMessageDialog(frame, "Unable to restart server! Configuration file has not been loaded!", "Error!", JOptionPane.ERROR_MESSAGE); } else if (item == itemServerMonitor) { menuChoiceNetworkMonitor(); } else if (item == itemTerminalLink) { if (isConfigLoaded && serverStartedDate != null) { if (menuChoiceTerminalLink(0)) panel.deselectAll(); } else JOptionPane.showMessageDialog(frame, "Unable to link terminal! Configuration is not loaded or server is not started!", "Error!", JOptionPane.ERROR_MESSAGE); } else if (item == itemTerminalUnlink) { if (isConfigLoaded && serverStartedDate != null) { if (menuChoiceTerminalUnlink(0)) panel.deselectAll(); } else JOptionPane.showMessageDialog(frame, "Unable to unlink terminal! Configuration is not loaded or server is not started!", "Error!", JOptionPane.ERROR_MESSAGE); } else if (item == itemTerminalUnlinkAll) { if (isConfigLoaded && serverStartedDate != null) { menuChoiceTerminalUnlinkAll(); panel.deselectAll(); } else JOptionPane.showMessageDialog(frame, "Unable to unlink terminals! Configuration is not loaded or server is not started!", "Error!", JOptionPane.ERROR_MESSAGE); } else if (item == itemTerminalSwap) { if (isConfigLoaded && serverStartedDate != null) { menuChoiceTerminalSwap(0, 0); panel.deselectAll(); } else JOptionPane.showMessageDialog(frame, "Unable to move terminal! Configuration is not loaded or server is not started!", "Error!", JOptionPane.ERROR_MESSAGE); } else if (item == itemGroupStart) { if (isConfigLoaded && serverStartedDate != null) { if (menuChoiceGroupStart(0)) panel.deselectAll(); } else JOptionPane.showMessageDialog(frame, "Unable to start group! Configuration is not loaded or server is not started!", "Error!", JOptionPane.ERROR_MESSAGE); } else if (item == itemGroupPause) { if (isConfigLoaded && serverStartedDate != null) { menuChoiceGroupPause(); panel.deselectAll(); } else JOptionPane.showMessageDialog(frame, "Unable to pause group! Configuration is not loaded or server is not started!", "Error!", JOptionPane.ERROR_MESSAGE); } else if (item == itemGroupStop) { if (isConfigLoaded && serverStartedDate != null) { if (menuChoiceGroupStop(0)) panel.deselectAll(); } else JOptionPane.showMessageDialog(frame, "Unable to stop group! Configuration is not loaded or server is not started!", "Error!", JOptionPane.ERROR_MESSAGE); } }
From source file:com.osparking.attendant.AttListForm.java
private void deleteAttendant() { /**// ww w. j a v a 2 s . co m * 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:com.biosis.biosislite.vistas.dialogos.DlgEmpleadoCRUD.java
private boolean hayErrores() { //COMPROBAMOS LOS DISTINTOS TIPOS String mensajeError = "Se han detectado los siguientes errores:\n"; int errores = 0; if (!(StringUtils.isNumeric(this.txtTelefono1.getText()) && StringUtils.isNumeric(this.txtTelefono2.getText()))) { mensajeError += "- El campo telfono debe ser numrico\n"; errores++;// w w w . j a v a2 s.c o m } if (errores > 0) { JOptionPane.showMessageDialog(this, mensajeError, "Mensaje del sistema", JOptionPane.WARNING_MESSAGE); } return errores != 0; }
From source file:client.welcome2.java
private void SupplierDeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SupplierDeleteButtonActionPerformed int ans = JOptionPane.showConfirmDialog(null, "Are You Sure You Want To Delete " + SupplierNameText1.getText() + " From The List ?", "Attention", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (ans == 0) { int raw = SuppliersTable.getSelectedRow(); tableClick = (SuppliersTable.getModel().getValueAt(raw, 0).toString()); String sql = "delete from suppliers where supplier_id='" + tableClick + "'"; try {//from w w w . jav a2 s . co m pst = conn.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(null, "Supplier Deleted!"); update_Supplier_table(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } if (ans == 1) { } }
From source file:com.biosis.biosislite.vistas.dialogos.DlgEmpleadoCRUD.java
private boolean hayErroresLaborales(String tipo) { //COMPROBAMOS LOS DISTINTOS TIPOS String mensajeError = "Se han detectado los siguientes errores:\n"; int errores = 0; // if(!(StringUtils.isNumeric(this.txtTelefono1.getText()) && StringUtils.isNumeric(this.txtTelefono2.getText()))){ // mensajeError += "- El campo telfono debe ser numrico\n"; // errores++; // }//from w w w. j av a2 s . c o m List<Contrato> listaContratos = cc.buscarXNombrexFechaASC(empleado); List<AreaEmpleado> listaAreas = ea.buscarXNombrexFechaASC(empleado); List<PuestoEmpleado> listaCargos = pec.buscarXNombrexFechaDESC(empleado); int conteo = 0; int erroresContratos = 0; int erroresCargos = 0; if (tipo.equals("Contrato")) { for (Contrato contratosList : listaContratos) { if (contratosList.getFechaFin() == null) { if (dcFechaInicio.getDate().compareTo(contratosList.getFechaInicio()) != 0) { conteo++; } } else if (((dcFechaInicio.getDate().compareTo(contratosList.getFechaInicio()) <= 0) & (dcFechaFin.getDate().compareTo(contratosList.getFechaInicio()) >= 0)) || ((dcFechaInicio.getDate().compareTo(contratosList.getFechaInicio()) >= 0) & (dcFechaInicio.getDate().compareTo(contratosList.getFechaFin()) <= 0))) { erroresContratos++; } } } if (tipo.equals("Area")) { for (AreaEmpleado areaList : listaAreas) { if (areaList.getFechaFin() == null) { if (dtFechaInicio.getDate().compareTo(areaList.getFechaInicio()) != 0) { conteo++; } } else if (((dtFechaInicio.getDate().compareTo(areaList.getFechaInicio()) <= 0) & (dtFechaFin.getDate().compareTo(areaList.getFechaInicio()) >= 0)) || ((dtFechaInicio.getDate().compareTo(areaList.getFechaInicio()) >= 0) & (dtFechaInicio.getDate().compareTo(areaList.getFechaFin()) <= 0))) { erroresContratos++; } } } if (tipo.equals("Cargo")) { for (PuestoEmpleado cargoList : listaCargos) { if (cargoList.getFechaFin() == null) { if (dtFechaInicioCargo.getDate().compareTo(cargoList.getFechaInicio()) != 0) { conteo++; } } else if (((dtFechaInicioCargo.getDate().compareTo(cargoList.getFechaInicio()) <= 0) & (dtFechaFinCargo.getDate().compareTo(cargoList.getFechaInicio()) >= 0)) || ((dtFechaInicioCargo.getDate().compareTo(cargoList.getFechaInicio()) >= 0) & (dtFechaInicioCargo.getDate().compareTo(cargoList.getFechaFin()) <= 0))) { erroresCargos++; } } } if (conteo > 0) { mensajeError += "- Se debe finalizar el ciclo del " + tipo + " antes de agregar otro\n"; errores++; } if (erroresContratos > 0) { mensajeError += "- Rango de fechas se encuentra en conflicto con algn " + tipo + "\n"; errores++; } if (erroresCargos > 0) { mensajeError += "- Rango de fechas se encuentra en conflicto con algn " + tipo + "\n"; errores++; } // boolean x = dcFechaFin.getDate().after(dcFechaInicio.getDate()); if (tipo.equals("Contrato")) { if (dcFechaFin.getDate() != null) { if (FechaUtil.soloFecha(dcFechaFin.getDate()) .compareTo(FechaUtil.soloFecha(dcFechaInicio.getDate())) <= 0) { mensajeError += "- La fecha de fin debe ser mayor a la fecha de inicio\n"; errores++; } } } else if (tipo.equals("Area")) { if (dtFechaFin.getDate() != null) { if (FechaUtil.soloFecha(dtFechaFin.getDate()) .compareTo(FechaUtil.soloFecha(dtFechaInicio.getDate())) <= 0) { mensajeError += "- La fecha de fin debe ser mayor a la fecha de inicio\n"; errores++; } } } else if (tipo.equals("Cargo")) { if (dtFechaFinCargo.getDate() != null) { if (FechaUtil.soloFecha(dtFechaFinCargo.getDate()) .compareTo(FechaUtil.soloFecha(dtFechaInicioCargo.getDate())) <= 0) { mensajeError += "- La fecha de fin debe ser mayor a la fecha de inicio\n"; errores++; } } } if (errores > 0) { JOptionPane.showMessageDialog(this, mensajeError, "Mensaje del sistema", JOptionPane.WARNING_MESSAGE); } return errores != 0; }
From source file:br.com.atmatech.sac.view.ViewAtendimento.java
private void atalhoBuscaCliente() { //if ((evt.getKeyCode() == KeyEvent.VK_F)) { // if (evt.isControlDown()) { String text = JOptionPane.showInputDialog(jDcliente, "Pesquisa: ", "PESQUISA", JOptionPane.WARNING_MESSAGE); if (text != null) { //DefaultTableModel tabela = (DefaultTableModel) jTtmodulo.getModel(); //final TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tabela); // jTtmodulo.setRowSorter(sorter); text = text.toUpperCase();//from w ww.j ava2 s . c o m // if (jTtdcliente.getColumnName(coluna).equals("FANTASIA")) { // buscaCliente("FANTASIA", text, "FANTASIA"); // } // if (jTtdcliente.getColumnName(coluna).equals("RAZAO")) { // buscaCliente("RAZAO", text, "RAZAO"); // } // if (jTtdcliente.getColumnName(coluna).equals("CNPJ")) { // buscaCliente("CNPJ", text, "CNPJ"); // } // if (jTtdcliente.getColumnName(coluna).equals("CIDADE")) { // buscaCliente("DISTRITO", text, "DISTRITO"); // } // if (jTtdcliente.getColumnName(coluna).equals("ENDERECO")) { // buscaCliente("ENDERECO", text, "ENDERECO"); // } buscaCliente(text, "RAZAO"); } // } // } }
From source file:de.huxhorn.lilith.swing.MainFrame.java
private void showApplicationPathChangedDialog() { if (logger.isInfoEnabled()) logger.info("showApplicationPathChangedDialog()"); final Object[] options = { "Exit", "Cancel" }; Icon icon = null;// www . j av a 2s .c om { URL url = MainFrame.class.getResource("/tango/32x32/status/dialog-warning.png"); if (url != null) { icon = new ImageIcon(url); } } int result = JOptionPane.showOptionDialog(this, "You have changed the application path.\n" + "You need to restart for this change to take effect.\n\n" + "Exit now?", "Exit now?", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, icon, options, options[0]); if (result == 0) { exit(); } }
From source file:de.huxhorn.lilith.swing.MainFrame.java
private void showLookAndFeelChangedDialog() { if (logger.isInfoEnabled()) logger.info("showLookAndFeelChangedDialog()"); final Object[] options = { "Exit", "Cancel" }; Icon icon = null;//from w w w.j a va2 s . c om { URL url = MainFrame.class.getResource("/tango/32x32/status/dialog-warning.png"); if (url != null) { icon = new ImageIcon(url); } } int result = JOptionPane.showOptionDialog(this, "You have changed the look & feel.\n" + "You need to restart for this change to take effect.\n\n" + "Exit now?", "Exit now?", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, icon, options, options[0]); if (result == 0) { exit(); } }
From source file:client.welcome2.java
private void Supplier_Show_Contract_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Supplier_Show_Contract_ButtonActionPerformed try {//w w w. j av a2s .c om int raw = SuppliersSearchTable.getSelectedRow(); tableClick = (SuppliersSearchTable.getModel().getValueAt(raw, 0).toString()); String sql = "select supplier_id, supplier_name, supplier_address,supplier_phone, supplier_email, supplier_contract_id from suppliers where supplier_id='" + tableClick + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); if (rs.next()) { String add1 = rs.getString("supplier_id"); String supplier2_filename_show_contract = "src/SupplierContracts/" + add1 + ".pdf"; Desktop.getDesktop().open(new File(supplier2_filename_show_contract)); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "This Supplier Does Not Have a Contract", "Attention", JOptionPane.WARNING_MESSAGE); } }