Example usage for javax.swing JOptionPane INFORMATION_MESSAGE

List of usage examples for javax.swing JOptionPane INFORMATION_MESSAGE

Introduction

In this page you can find the example usage for javax.swing JOptionPane INFORMATION_MESSAGE.

Prototype

int INFORMATION_MESSAGE

To view the source code for javax.swing JOptionPane INFORMATION_MESSAGE.

Click Source Link

Document

Used for information messages.

Usage

From source file:com.biosis.biosislite.vistas.inventario.MantenimientoClase.java

private void btnguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarActionPerformed
    // TODO add your handling code here:
    String palabra = "";
    String palabra2 = "";
    if (accion == 1) {
        palabra = "registrar";
        palabra2 = "registrado";

        if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " la Clase?", "Mensaje del Sistema",
                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
            claseControlador.getSeleccionado().setCodigo(codigoField.getText().toUpperCase());
            claseControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase());

            claseControlador.accion(accion);
            lista.add(claseControlador.getSeleccionado());

            if (accion == 1) {
                JOptionPane.showMessageDialog(null, "Clase " + palabra2 + " correctamente",
                        "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE);
                FormularioUtil.limpiarComponente(panelDatos);
            } else {
                JOptionPane.showMessageDialog(null, "Clase no " + palabra2, "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }//  www.  j  a v  a 2  s. c  o m
        } else {
            FormularioUtil.limpiarComponente(panelDatos);
            JOptionPane.showMessageDialog(null, "Clase no " + palabra2, "Mensaje del Sistema",
                    JOptionPane.ERROR_MESSAGE);
        }
    } else if (accion == 2) {
        palabra = "modificar";
        palabra2 = "modificado";

        if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " la Clase?", "Mensaje del Sistema",
                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

            if (accion == 2) {
                JOptionPane.showMessageDialog(null, "Clase " + palabra2 + " correctamente",
                        "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE);

                lista.clear();
                claseControlador.getSeleccionado().setCodigo(codigoField.getText().toUpperCase());
                claseControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase());
                claseControlador.accion(accion);
                listar();

                FormularioUtil.limpiarComponente(panelDatos);

            } else {
                JOptionPane.showMessageDialog(null, "Clase no " + palabra2, "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }
        } else {
            FormularioUtil.limpiarComponente(panelDatos);
            JOptionPane.showMessageDialog(null, "Clase no " + palabra2, "Mensaje del Sistema",
                    JOptionPane.ERROR_MESSAGE);
        }
    }

    FormularioUtil.activarComponente(panelOpciones, true);
    FormularioUtil.activarComponente(panelGuardar, false);
    FormularioUtil.activarComponente(panelDatos, false);

}

From source file:ffx.ui.KeywordPanel.java

/**
 * Give the user a File Dialog Box so they can select a key file.
 *//*from w  ww .j  av  a2  s.  co m*/
public void keyOpen() {
    if (fileOpen && KeywordComponent.isKeywordModified()) {
        int option = JOptionPane.showConfirmDialog(this, "Save Changes First", "Opening New File",
                JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
        if (option == JOptionPane.CANCEL_OPTION) {
            return;
        } else if (option == JOptionPane.YES_OPTION) {
            keySave(currentKeyFile);
        }
        keyClear();
    }
    JFileChooser d = MainPanel.resetFileChooser();
    if (currentSystem != null) {
        File cwd = currentSystem.getFile();
        if (cwd != null && cwd.getParentFile() != null) {
            d.setCurrentDirectory(cwd.getParentFile());
        }
    }
    d.setAcceptAllFileFilterUsed(false);
    d.setFileFilter(MainPanel.keyFileFilter);
    d.setDialogTitle("Open KEY File");
    int result = d.showOpenDialog(this);
    if (result == JFileChooser.APPROVE_OPTION) {
        File newKeyFile = d.getSelectedFile();
        if (newKeyFile != null && newKeyFile.exists() && newKeyFile.canRead()) {
            keyOpen(newKeyFile);
        }
    }
}

From source file:ch.bfh.lca._15h.server.gui.MainWindowServer.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

    // JFileChooser-Objekt erstellen
    JFileChooser chooser = new JFileChooser();
    // Dialog zum Speichern von Dateien anzeigen
    int resultValue = chooser.showDialog(null, "Bitte whle die json Datei aus, die Sie importieren mchten");

    if (resultValue == JFileChooser.APPROVE_OPTION) {
        this.txtJsonPath.setText(chooser.getSelectedFile().getAbsolutePath());
        ImportHandler ih = new ImportHandler(this.txtJsonPath.getText(), this.txtDatabasePath.getText());
        ih.importData();//from w  w w.j a  v a 2s.c  o  m
        JOptionPane.showMessageDialog(new JFrame(), "Import finished", "Information",
                JOptionPane.INFORMATION_MESSAGE);
    }

}

From source file:javaresturentdesktopclient.EmployeeDetailsPage.java

private void jButtonUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonUpdateActionPerformed
    // TODO add your handling code here:
    String fName = jTextFieldFirstNAme.getText();
    String lName = jTextFieldLastName.getText();
    String address = jTextFieldAddress.getText();
    String contact = jTextFieldcontact.getText();
    String national_id = jTextFieldNationalId.getText();
    String salary = jTextFieldSalary.getText();
    String employeeId = jTextFieldEmpId.getText();

    ServletRequest.setServletRequest(Constant.EMPLOYEE_SERVLET);
    List<NameValuePair> paramLis = new ArrayList<>();
    ServletRequest.setServletRequest(Constant.EMPLOYEE_SERVLET);
    paramLis.add(new BasicNameValuePair(Constant.KEY_COMMAND, Constant.KEY_UPDATE_EMPLOYEE));
    paramLis.add(new BasicNameValuePair(Constant.KEY_EMPLOYEE_ID, employeeId));
    paramLis.add(new BasicNameValuePair(Constant.KEY_FNAME, fName));
    paramLis.add(new BasicNameValuePair(Constant.KEY_LNAME, lName));
    paramLis.add(new BasicNameValuePair(Constant.KEY_ADDRESS, address));
    paramLis.add(new BasicNameValuePair(Constant.KEY_CONTACT, contact));
    paramLis.add(new BasicNameValuePair(Constant.KEY_NATIONAL_ID, national_id));
    paramLis.add(new BasicNameValuePair(Constant.KEY_POSITION, position));
    paramLis.add(new BasicNameValuePair(Constant.KEY_SALARY, salary));

    String response = HttpClientUtil.postRequest(paramLis);
    if (response.equalsIgnoreCase("success")) {
        JOptionPane.showMessageDialog(null, "Successfully updated", "Information",
                JOptionPane.INFORMATION_MESSAGE);
        jTextFieldFirstNAme.setText(null);
        jTextFieldLastName.setText(null);
        jTextFieldAddress.setText(null);
        jTextFieldcontact.setText(null);
        jTextFieldNationalId.setText(null);
        jTextFieldSalary.setText(null);/*w w  w. j av a 2  s  .c om*/
        ShowTable(position);
        SetEmployeeId();
    } else {
        JOptionPane.showMessageDialog(null, "Failed!" + "please enter data correctly, thank you.",
                "Error Message", JOptionPane.ERROR_MESSAGE);
    }

}

From source file:com.biosis.biosislite.vistas.inventario.MantenimientoProveedor.java

private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed
    // TODO add your handling code here:
    accion = AbstractControlador.ELIMINAR;
    if (tblProveedor.getSelectedRow() != -1) {

        Integer codigo = tblProveedor.getSelectedRow();

        Proveedor proveedor = lista.get(codigo);

        if (proveedor != null) {
            if (JOptionPane.showConfirmDialog(null, "Desea Eliminar el Proveedor?", "Mensaje del Sistema",
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

                int[] filas = tblProveedor.getSelectedRows();
                for (int i = 0; i < filas.length; i++) {
                    Proveedor empleado2 = lista.get(filas[0]);
                    lista.remove(empleado2);
                    proveedorControlador.setSeleccionado(empleado2);
                    proveedorControlador.accion(accion);
                }/*from  ww w. ja v  a2s  . c o m*/
                if (proveedorControlador.accion(accion) == 3) {
                    JOptionPane.showMessageDialog(null, "Proveedor eliminado correctamente",
                            "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE);

                } else {
                    JOptionPane.showMessageDialog(null, "Proveedor no eliminado", "Mensaje del Sistema",
                            JOptionPane.ERROR_MESSAGE);
                }
            } else {
                JOptionPane.showMessageDialog(null, "Proveedor no eliminado", "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    } else {
        JOptionPane.showMessageDialog(null, "Debe seleccionar un Empleado", "Mensaje del Sistema",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:de.quadrillenschule.azocamsyncd.gui.ConfigurationWizardJFrame.java

private void autoruninstalljButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoruninstalljButton1ActionPerformed
    boolean success = false;
    JFileChooser jfc = new JFileChooser();
    jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    jfc.setApproveButtonText("Prepare card...");
    File startFile = new File(System.getProperty("user.dir")); //Get the current directory

    // Find System Root
    while (!FileSystemView.getFileSystemView().isFileSystemRoot(startFile)) {
        startFile = startFile.getParentFile();
    }//  w w w. ja v a  2 s . com

    jfc.setCurrentDirectory(startFile);
    int origDriveChooserRetVal = jfc.showDialog(rootPane, "Open");
    if (origDriveChooserRetVal == JFileChooser.APPROVE_OPTION) {
        try {
            File myfile = new File(jfc.getSelectedFile().getAbsolutePath(), "autorun.sh");
            myfile.createNewFile();
            FileOutputStream fos;
            try {
                fos = new FileOutputStream(myfile);
                IOUtils.copy(getClass().getResourceAsStream(
                        "/de/quadrillenschule/azocamsyncd/ftpservice/res/autorun.sh"), fos);
                fos.close();
                success = true;
            } catch (FileNotFoundException ex) {
                Logger.getLogger(ConfigurationWizardJFrame.class.getName()).log(Level.SEVERE, null, ex);
            }

        } catch (IOException ex) {
            Logger.getLogger(ConfigurationWizardJFrame.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
    if (!success) {
        JOptionPane.showMessageDialog(rootPane,
                "The WiFi is SD card could not be written to. Please check if you selected the right card and it is not write-protected.",
                "SD card could not be prepared", JOptionPane.WARNING_MESSAGE);
    } else {
        JOptionPane.showMessageDialog(rootPane,
                "The WiFi SD card is prepared for operating an FTP and Telnet server.", "Success!",
                JOptionPane.INFORMATION_MESSAGE);
        step0jCheckBox.setSelected(true);
        step0jCheckBox.setText("Done");
        updateSelectedPanel(1);
    }
}

From source file:com.diversityarrays.kdxplore.trials.TrialDetailsPanel.java

private void doGenerateBarcodes(Trial trial) {

    KdxploreDatabase kdxdb = offlineData.getKdxploreDatabase();
    final KDSmartDatabase database = kdxdb.getKDXploreKSmartDatabase();

    String what = "";
    try {//from w  w  w .  j  a  va  2  s. co m
        final List<Plot> plotsToUpdate = new ArrayList<>();
        final List<Specimen> specimensToUpdate = new ArrayList<>();
        final List<Trait> traitsToUpdate = new ArrayList<>();

        what = " for Traits";
        for (Trait trait : kdxdb.getTrialTraits(trial.getTrialId())) {
            if (isNullOrEmpty(trait.getBarcode())) {
                BarcodeFactory.setTraitBarcode(trait);
                traitsToUpdate.add(trait);
            }
        }

        // = = = = = = = =

        what = " for Plots and Specimens";

        TrialItemVisitor<Plot> trialPlotVisitor = new TrialItemVisitor<Plot>() {
            @Override
            public void setExpectedItemCount(int count) {
            }

            @Override
            public boolean consumeItem(Plot plot) throws IOException {
                if (isNullOrEmpty(plot.getBarcode())) {
                    BarcodeFactory.setPlotBarcode(plot);
                    plotsToUpdate.add(plot);
                }

                for (Specimen specimen : plot.getSpecimens()) {
                    if (isNullOrEmpty(specimen.getBarcode())) {
                        BarcodeFactory.setSpecimenBarcode(specimen);
                        specimensToUpdate.add(specimen);
                    }
                }
                return true;
            }
        };

        Either<? extends Throwable, Boolean> either1 = database.visitPlotsForTrial(trial.getTrialId(),
                SampleGroupChoice.ANY_SAMPLE_GROUP,
                KDSmartDatabase.WithPlotAttributesOption.WITHOUT_PLOT_ATTRIBUTES, trialPlotVisitor);
        if (!either1.isRight()) {
            Throwable error = either1.left();
            if (error instanceof IOException) {
                throw ((IOException) error);
            }
            throw new IOException(error);
        }

        int nTraits = traitsToUpdate.size();
        int nPlots = plotsToUpdate.size();
        int nSpecimens = specimensToUpdate.size();

        if ((nTraits + nPlots + nSpecimens) > 0) {

            BatchHandler<Void> callable = new BatchHandler<Void>() {

                @Override
                public Void call() throws Exception {
                    for (Trait trait : traitsToUpdate) {
                        database.saveTrait(trait, false);
                    }
                    for (Plot plot : plotsToUpdate) {
                        database.savePlot(plot, false);
                    }

                    for (Specimen specimen : specimensToUpdate) {
                        database.saveSpecimen(specimen, false);
                    }
                    return null;
                }

                @Override
                public boolean checkSuccess(Void arg0) {
                    return true;
                }
            };
            Either<Exception, Void> either = database.doBatch(callable);
            if (either.isRight()) {
                StringBuilder sb = new StringBuilder("Added barcodes for");
                if (nTraits > 0) {
                    sb.append("\nTraits: ").append(nTraits);
                }
                if (nPlots > 0) {
                    sb.append("\nPlots: ").append(nPlots);
                }
                if (nSpecimens > 0) {
                    sb.append("\nSpecimens: ").append(nSpecimens);
                }
                messagePrinter.println(sb.toString());
            } else {
                messagePrinter.println("Problem while adding barcodes:");
                messagePrinter.println(either.left());
            }
        } else {
            JOptionPane.showMessageDialog(TrialDetailsPanel.this,
                    "All Traits,Plots and Specimens have barcodes", "Add Barcodes",
                    JOptionPane.INFORMATION_MESSAGE);
        }

    } catch (IOException err) {
        reportError("Unable to get Trial data" + what + "\n" + err.getMessage(), err);
    }
}

From source file:com.proyecto.vista.MantenimientoArea.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 v  a 2 s.  c  o  m*/
    if (tblarea.getSelectedRow() != -1) {

        Integer codigo = tblarea.getSelectedRow();

        Area area = areaControlador.buscarPorId(lista.get(codigo).getId());

        if (area != null) {
            if (JOptionPane.showConfirmDialog(null, "Desea Eliminar la Area?", "Mensaje del Sistema",
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

                int[] filas = tblarea.getSelectedRows();
                for (int i = 0; i < filas.length; i++) {
                    Area area2 = lista.get(filas[0]);
                    lista.remove(area2);
                    areaControlador.setSeleccionado(area2);
                    areaControlador.accion(accion);
                }
                if (areaControlador.accion(accion) == 3) {
                    JOptionPane.showMessageDialog(null, "Area eliminada correctamente", "Mensaje del Sistema",
                            JOptionPane.INFORMATION_MESSAGE);

                } else {
                    JOptionPane.showMessageDialog(null, "Area no eliminada", "Mensaje del Sistema",
                            JOptionPane.ERROR_MESSAGE);
                }
            } else {
                JOptionPane.showMessageDialog(null, "Area no eliminada", "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    } else {
        JOptionPane.showMessageDialog(null, "Debe seleccionar un Area", "Mensaje del Sistema",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:fi.hoski.remote.ui.Admin.java

private void menuReservation() {
    menuReservation = new JMenu();
    TextUtil.populate(menuReservation, "RESERVATIONS");
    menuBar.add(menuReservation);// ww  w .jav  a2  s  . c  om
    JMenu menuMakeReservation = new JMenu();
    TextUtil.populate(menuMakeReservation, "MAKE RESERVATION");
    menuReservation.add(menuMakeReservation);
    JMenu editReservation = new JMenu();
    TextUtil.populate(editReservation, "EDIT RESERVATION");
    menuReservation.add(editReservation);
    JMenu mailMenu = new JMenu();
    TextUtil.populate(mailMenu, "SEND EMAIL");
    menuReservation.add(mailMenu);
    JMenu smsMenu = new JMenu();
    TextUtil.populate(smsMenu, "SEND SMS");
    smsMenu.setEnabled(serverProperties.isZonerSMSSupported());
    menuReservation.add(smsMenu);
    for (final EventType eventType : EventType.values()) {
        ActionListener action = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                reservate(eventType, null);
            }
        };
        action = createActionListener(frame, action);
        JMenuItem menuItem = new JMenuItem();
        TextUtil.populate(menuItem, eventType.name());
        menuItem.addActionListener(action);
        menuMakeReservation.add(menuItem);
        JMenuItem editItem = new JMenuItem();
        TextUtil.populate(editItem, eventType.name());
        ActionListener editAction = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                editReservations(eventType);
            }
        };
        editAction = createActionListener(frame, editAction);
        editItem.addActionListener(editAction);
        if (Event.isInspection(eventType)) {
            editItem.setEnabled(accessUser);
        }
        editReservation.add(editItem);
        JMenuItem mailItem = new JMenuItem();
        TextUtil.populate(mailItem, eventType.name());
        ActionListener mailAction = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                List<Event> selected = chooseEvents(eventType, "CHOOSE", true);
                if (selected != null && selected.size() == 1) {
                    try {
                        Event event = selected.get(0);
                        List<Reservation> reservationList = dss.getReservations(event);
                        Day date = (Day) event.get(Event.EventDate);
                        String subject = TextUtil.getText(eventType.name()) + " " + date;
                        String body = getMessage(eventType.name());
                        MailDialog md = new MailDialog(frame, subject, body, reservationList);
                        if (md.edit()) {
                        }
                    } catch (AddressException ex) {
                        throw new IllegalArgumentException(ex);
                    }
                } else {
                    JOptionPane.showMessageDialog(frame, TextUtil.getText("NO SELECTION"),
                            TextUtil.getText("MESSAGE"), JOptionPane.INFORMATION_MESSAGE);
                }
            }
        };
        mailAction = createActionListener(frame, mailAction);
        mailItem.addActionListener(mailAction);
        mailMenu.add(mailItem);
        JMenuItem smsItem = new JMenuItem();
        TextUtil.populate(smsItem, eventType.name());
        ActionListener smsAction = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                List<Event> selected = chooseEvents(eventType, "CHOOSE", true);
                if (selected != null && selected.size() == 1) {
                    try {
                        Event event = selected.get(0);
                        List<Reservation> reservationList = dss.getReservations(event);

                        List<String> phoneList = new ArrayList<String>();
                        for (Reservation r : reservationList) {
                            String number = (String) r.get(Repository.JASENET_MOBILE);
                            if (number != null) {
                                phoneList.add(number);
                            }
                        }
                        SMSDialog sd = new SMSDialog(frame, TextUtil.getText(eventType.name()), "", phoneList);
                        if (sd.edit()) {
                        }
                    } catch (IOException ex) {
                        JOptionPane.showMessageDialog(frame, ex.getMessage());
                    } catch (SMSException ex) {
                        JOptionPane.showMessageDialog(frame, ex.getMessage());
                    }
                } else {
                    JOptionPane.showMessageDialog(frame, TextUtil.getText("NO SELECTION"),
                            TextUtil.getText("MESSAGE"), JOptionPane.INFORMATION_MESSAGE);
                }
            }
        };
        smsAction = createActionListener(frame, smsAction);
        smsItem.addActionListener(smsAction);
        smsMenu.add(smsItem);
    }
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.SingleCellStatisticsController.java

/**
 * Remove a Group of Conditions//  w  w w  .  j ava2  s  . c om
 */
private void removeGroupFromAnalysis() {
    // selected group
    int selectedIndex = singleCellAnalysisController.getAnalysisPanel().getAnalysisGroupList()
            .getSelectedIndex();
    // check if an element is selected first
    if (selectedIndex != -1) {
        groupsBindingList.remove(selectedIndex);
    } else {
        singleCellAnalysisController.showMessage("Select a group to remove from current analysis!",
                "remove group error", JOptionPane.INFORMATION_MESSAGE);
    }
}