Example usage for javax.swing JOptionPane showOptionDialog

List of usage examples for javax.swing JOptionPane showOptionDialog

Introduction

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

Prototype

@SuppressWarnings("deprecation")
public static int showOptionDialog(Component parentComponent, Object message, String title, int optionType,
        int messageType, Icon icon, Object[] options, Object initialValue) throws HeadlessException 

Source Link

Document

Brings up a dialog with a specified icon, where the initial choice is determined by the initialValue parameter and the number of choices is determined by the optionType parameter.

Usage

From source file:course_generator.frmMain.java

/**
 * Called when the main form is closing// w ww. j  av a 2s  . c om
 * 
 * @param evt
 */
private void formWindowClosing(java.awt.event.WindowEvent evt) {
    if (Track.isModified) {
        Object[] options = { " " + bundle.getString("frmMain.ClosingYes") + " ",
                " " + bundle.getString("frmMain.ClosingNo") + " " };
        int ret = JOptionPane.showOptionDialog(this, bundle.getString("frmMain.ClosingMessage"),
                bundle.getString("frmMain.ClosingTitle"), JOptionPane.YES_NO_OPTION,
                JOptionPane.WARNING_MESSAGE, null, options, options[1]);

        if (ret == JOptionPane.YES_OPTION) {
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            SaveConfig();
        } else {
            setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        }
    } else { // No modification! Bye
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        SaveConfig();
    }
}

From source file:edu.ku.brc.specify.tasks.WorkbenchTask.java

/**
 * This filters out all non-image files per the image filter and adds them to the Vector.
 * @param files the list of files/*from www .java 2  s  .  co  m*/
 * @param fileList the returned Vector of image files
 * @param imageFilter the filter to use to weed out non-image files
 * @return true if it should continue, false to stop
 */
protected boolean filterSelectedFileNames(final File[] files, final Vector<File> fileList,
        final ImageFilter imageFilter) {
    if (files == null || files.length == 0) {
        return false;
    }

    Hashtable<String, Boolean> badFileExts = new Hashtable<String, Boolean>();

    for (int i = 0; i < files.length; i++) {
        if (files[i].isFile()) {
            String fileName = files[i].getName();
            if (imageFilter.isImageFile(fileName)) {
                fileList.add(files[i]);
            } else {
                badFileExts.put(FilenameUtils.getExtension(fileName), true);
            }
        }
    }

    // No check to see if we had any bad files and warn the user about them
    if (badFileExts.size() > 0) {
        StringBuffer badExtStrBuf = new StringBuffer();
        for (String ext : badFileExts.keySet()) {
            if (badExtStrBuf.length() > 0)
                badExtStrBuf.append(", ");
            badExtStrBuf.append(ext);
        }

        // Now, if none of the files were good we tell them and then quit the import task
        if (fileList.size() == 0) {
            JOptionPane.showMessageDialog(UIRegistry.getMostRecentWindow(),
                    String.format(getResourceString("WB_WRONG_IMG_NO_IMAGES"),
                            new Object[] { badExtStrBuf.toString() }),
                    UIRegistry.getResourceString("WARNING"), JOptionPane.ERROR_MESSAGE);
            return false;

        }

        // So we know we have at least one good image file type
        // So let them choose if they want to continue.
        Object[] options = { getResourceString("Continue"), getResourceString("Stop") };

        if (JOptionPane.showOptionDialog(UIRegistry.getMostRecentWindow(),
                String.format(getResourceString("WB_WRONG_IMG_SOME_IMAGES"),
                        new Object[] { badExtStrBuf.toString() }),
                title, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options,
                options[1]) == JOptionPane.NO_OPTION) {
            return false;
        }
    }
    return true;
}

From source file:org.forester.archaeopteryx.TreePanel.java

final private void pasteSubtree(final PhylogenyNode node) {
    if (getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED) {
        errorMessageNoCutCopyPasteInUnrootedDisplay();
        return;/*from  w  w w .  j  av  a2  s  . c  o m*/
    }
    if ((getCutOrCopiedTree() == null) || getCutOrCopiedTree().isEmpty()) {
        JOptionPane.showMessageDialog(this, "No tree in buffer (need to copy or cut a subtree first)",
                "Attempt to paste with empty buffer", JOptionPane.ERROR_MESSAGE);
        return;
    }
    final String label = getASimpleTextRepresentationOfANode(getCutOrCopiedTree().getRoot());
    final Object[] options = { "As sibling", "As descendant", "Cancel" };
    final int r = JOptionPane.showOptionDialog(this, "How to paste subtree" + label + "?", "Paste Subtree",
            JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[2]);
    boolean paste_as_sibling = true;
    if (r == 1) {
        paste_as_sibling = false;
    } else if (r != 0) {
        return;
    }
    final Phylogeny buffer_phy = getCutOrCopiedTree().copy();
    buffer_phy.setAllNodesToNotCollapse();
    buffer_phy.preOrderReId();
    if (paste_as_sibling) {
        if (node.isRoot()) {
            JOptionPane.showMessageDialog(this, "Cannot paste sibling to root",
                    "Attempt to paste sibling to root", JOptionPane.ERROR_MESSAGE);
            return;
        }
        buffer_phy.addAsSibling(node);
    } else {
        buffer_phy.addAsChild(node);
    }
    if (getCopiedAndPastedNodes() == null) {
        setCopiedAndPastedNodes(new HashSet<PhylogenyNode>());
    }
    getCopiedAndPastedNodes().addAll(PhylogenyMethods.obtainAllNodesAsSet(buffer_phy));
    _phylogeny.externalNodesHaveChanged();
    _phylogeny.hashIDs();
    _phylogeny.recalculateNumberOfExternalDescendants(true);
    resetNodeIdToDistToLeafMap();
    setEdited(true);
    repaint();
}

From source file:common.SwingGUI01.java

private void showErrorDialog(String errorMessage) {

    String[] choices = { "OK" };
    int response = JOptionPane.showOptionDialog(this, errorMessage,
            ResourceBundle.getBundle("strings").getString("error"), JOptionPane.DEFAULT_OPTION,
            JOptionPane.ERROR_MESSAGE, null, choices, choices[0]);
}

From source file:com.xilinx.ultrascale.gui.MainScreen_video.java

private void windowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_windowClosing
    // TODO add your handling code here:
    //powerTimer.cancel();
    Object[] options1 = { "No", "Yes" };
    int s = JOptionPane.showOptionDialog(null, "This will uninstall Device Drivers. Are you sure?", " ",
            JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null);

    if (s == 1) {
        loadDelay = 0;/*ww  w . j  a va2 s.co m*/
        timer.cancel();
        if (testStarted) {
            testStarted = false;
            jbuttonEngStart.setText("Start");
            int size = Integer.parseInt(sizeTextField.getText());
            di.stopTest(0, testMode, size);
        }
        if (ethTestStarted0) {
            ethTestStarted0 = false;
            jbuttonEngStart1.setText("Start");
            int size = Integer.parseInt(sizeTextField1.getText());
            di.stopTest(0, eth0TestMode, size);
        }
        if (ethTestStarted1) {
            ethTestStarted1 = false;
            jbuttonEngStart2.setText("Start");
            int size = Integer.parseInt(sizeTextField2.getText());
            di.stopTest(0, eth1TestMode, size);
        }
        System.gc();
        di.flush();
        lp.uninstallDrivers(this);
        showDialog("Removing Device Drivers...Please wait...");
    }
    //        lp.showLP();
    if (txMediaPlayer != null) {
        // Cleanly dispose of the media player instance and any associated native resources
        txMediaPlayer.release();

        // Cleanly dispose of the media player factory and any associated native resources
        //txMediaPlayerFactory.release();
        rxMediaPlayer.release();

        // Cleanly dispose of the media player factory and any associated native resources
        //rxMediaPlayerFactory.release();
        videoFrame.dispose();
        frame1.dispose();
        frame2.dispose();
    }
}

From source file:com.xilinx.ultrascale.gui.MainScreen.java

private void windowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_windowClosing
    // TODO add your handling code here:
    //powerTimer.cancel();
    Object[] options1 = { "No", "Yes" };
    int s = JOptionPane.showOptionDialog(null, "This will uninstall Device Drivers. Are you sure?", " ",
            JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null);

    if (s == 1) {
        timer.cancel();//from  w w w.  j  a  v a2  s .  c o  m
        if (testStarted) {
            testStarted = false;
            jbuttonEngStart.setText("Start");
            int size = Integer.parseInt(sizeTextField.getText());
            di.stopTest(0, testMode, size);
        }
        if (ethTestStarted0) {
            ethTestStarted0 = false;
            jbuttonEngStart1.setText("Start");
            int size = Integer.parseInt(sizeTextField1.getText());
            di.stopTest(0, eth0TestMode, size);
        }
        if (ethTestStarted1) {
            ethTestStarted1 = false;
            jbuttonEngStart2.setText("Start");
            int size = Integer.parseInt(sizeTextField2.getText());
            int distatus = di.stopTest1(1, eth1TestMode, size);
            //System.out.println("distatus after stop " + distatus);
        }

        System.gc();
        di.flush();
        lp.uninstallDrivers(this);
        showDialog("Removing Device Drivers...Please wait...");
    }
    //        lp.showLP();
}

From source file:interfaces.InterfazPrincipal.java

private void botonGuardarFacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonGuardarFacturaActionPerformed
    // TODO add your handling code here:

    String id_cliente = jTextField_Factura_Cliente_Id.getText();

    if (id_cliente.equals("") || valorActualFactura.equals("0.0")) {
        JOptionPane.showMessageDialog(this,
                "Por favor indique el monto de la factura o ingrese los productos a ella");

    } else {//from  w w  w.  j a v  a  2  s.  com
        //System.err.println("Numero de filas" + TablaDeFacturaProducto.getRowCount());
        ArrayList<String> lineaCodigoProductos = new ArrayList<String>();
        ArrayList<String> lineaUnidadesProductos = new ArrayList<String>();
        ArrayList<String> lineaMontoProductos = new ArrayList<String>();
        double monto = 0d;
        try {
            double pago = Double.parseDouble(
                    (String) JOptionPane.showInputDialog("Ingrese por favor el monto pagado por el cliente"));
            while (pago < 0.0) {
                pago = Double.parseDouble((String) JOptionPane.showInputDialog(
                        "El pago debe ser positivo \nIngrese por favor el monto pagado por el cliente"));

            }

            double prestamo = Double.parseDouble(valorActualPrestamo.getText());
            double montoFactura = Double.parseDouble(valorActualFactura.getText());
            while (montoFactura - pago < 0.0) {
                pago = Double.parseDouble((String) JOptionPane.showInputDialog(
                        "El pago no debe ser superior al monto de la factura \nIngrese por favor el monto pagado por el cliente"));

            }
            if (prestamo - montoFactura <= 0.0) {
                int opcion = JOptionPane.showConfirmDialog(this,
                        "Con este prstamo el cliente excede su limite de prestamos. \n Desea continuar?",
                        "Mensaje del sistema", JOptionPane.YES_NO_OPTION);
                if (opcion != JOptionPane.YES_OPTION) {
                    return;
                }

            }

            for (int i = 0; i < TablaDeFacturaProducto.getRowCount(); i++) {
                /*
                 * Fila 0: ID producto
                 * Fila 4: Cantidad
                 */
                String ProductoId = String.valueOf(TablaDeFacturaProducto.getValueAt(i, 0));
                lineaCodigoProductos.add(ProductoId);

                int numeroUnidades = Integer.parseInt(String.valueOf(TablaDeFacturaProducto.getValueAt(i, 4)));

                String unidades = String.valueOf(numeroUnidades);
                lineaUnidadesProductos.add(unidades);

                double valorUnitario = Double
                        .parseDouble(String.valueOf(TablaDeFacturaProducto.getValueAt(i, 5)));
                double valorProductoTotal = numeroUnidades * valorUnitario;
                lineaMontoProductos.add(String.valueOf(valorProductoTotal));

                monto += valorProductoTotal;
            }

            if (TablaDeFacturaProducto.getRowCount() == 0) {
                monto = Double.parseDouble(valorActualFactura.getText());
            }

            String estado = "";
            if (monto == pago) {
                estado = "pagado";
            } else {
                estado = "fiado";
            }

            ControladorFactura controladorFactura = new ControladorFactura();
            //String[] selection = {"cliente_id", "fecha", "estado", "identificacionCliente"};
            Calendar calendario = Calendar.getInstance();
            String dia = Integer.toString(calendario.get(Calendar.DATE));
            String mes = Integer.toString(calendario.get(Calendar.MONTH)) + 1;
            String annio = Integer.toString(calendario.get(Calendar.YEAR));
            Date date = new Date();
            DateFormat hourFormat = new SimpleDateFormat("HH:mm:ss");
            String hora = hourFormat.format(date);

            String fecha = annio + "-" + mes + "-" + dia + " " + hora;
            String[] selection = { id_cliente, fecha, estado, String.valueOf(monto) };
            ArrayList<String[]> facturaActual = controladorFactura.insertFactura(selection);

            //Ingresar productos
            if (TablaDeFacturaProducto.getRowCount() > 0) {
                ControladorFactura_Productos controladorFactura_Productos = new ControladorFactura_Productos();
                for (int i = 0; i < lineaCodigoProductos.size(); i++) {
                    //        String [] selection = {"factura_id","producto_id","unidades","precio"};
                    String[] insertarLineaProducto = { facturaActual.get(0)[0], lineaCodigoProductos.get(i),
                            lineaUnidadesProductos.get(i), lineaMontoProductos.get(i) };
                    controladorFactura_Productos.insertFactura_Productos(insertarLineaProducto);
                }
            }
            //Ingresar flujo factura
            ControladorFlujoFactura controladorFlujoFactura = new ControladorFlujoFactura();
            // String [] selection = {"factura_id","tipo_flujo","fecha","identificacionCliente"};

            String value[] = { facturaActual.get(0)[0], "abono", fecha, String.valueOf(pago) };
            controladorFlujoFactura.insertFlujo_Factura(value);

            String value2[] = { facturaActual.get(0)[0], "deuda", fecha, String.valueOf(monto) };
            controladorFlujoFactura.insertFlujo_Factura(value2);

            botonEstablecerMontoFactura.setEnabled(false);
            botonAgregarProducto.setEnabled(false);
            botonGuardarFactura.setEnabled(false);
            jTextField_Factura_Cliente_Id.setText("");

            DefaultTableModel modeloTabla = (DefaultTableModel) TablaDeFacturaProducto.getModel();

            for (int i = 0; i < modeloTabla.getRowCount(); i++) {
                modeloTabla.removeRow(i);
            }

            modeloTabla.setRowCount(0);
            TablaDeFacturaProducto.setModel(modeloTabla);

            Object opciones[] = { "Cerrar", "Imprimir", "Guardar en disco" };
            GenerarFactura generarFactura = new GenerarFactura();
            int opcion = JOptionPane.showOptionDialog(this,
                    "Se ha guardado la factura con xito\nQue desea hacer?", "Elija una opcin",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, opciones, null);

            switch (opcion) {
            case 1:
                generarFactura.imprimirFactura(Integer.parseInt(facturaActual.get(0)[0]), this);
                break;
            case 2:
                PDDocument documento = generarFactura.crearFactura(Integer.parseInt(facturaActual.get(0)[0]),
                        this);
                JFileChooser fc = new JFileChooser();
                FileNameExtensionFilter filter = new FileNameExtensionFilter("Archivo PDF", "pdf", "text");
                fc.setFileFilter(filter);
                fc.showSaveDialog(this);
                if (fc.getSelectedFile() != null) {
                    File selectedFile = fc.getSelectedFile();
                    try {

                        documento.save(selectedFile + ".pdf");
                        JOptionPane.showMessageDialog(this, "El archivo ha sido guardado en disco");

                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(this, "EL Archivo no se puede leer!");
                    }
                }
                break;

            default:
                break;
            }

            nombreClienteCrearFactura.setText("");
            IdentificacionClienteBuscarFactura.setText("");
            valorActualPrestamo.setText("");
            jTextField_Factura_Cliente_Id.setText("");
            jTextField_Factura_Producto_Nombre.setText("");
            jTextField_Factura_Producto_Descripcion.setText("");
            valorMontoFactura.setText("");
            valorActualFactura.setText("0.0");
            valorActualPrestamo.setText("0.0");
            botonGuardarFactura.setEnabled(false);
            botonEstablecerMontoFactura.setEnabled(false);
            botonAgregarProducto.setEnabled(false);
        } catch (Exception e) {
        }

    }

}

From source file:com.xilinx.ultrascale.gui.MainScreen.java

private void videoplayButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_videoplayButtonActionPerformed
    // TODO add your handling code here:
    if (videoplayButton.getText().equalsIgnoreCase("Start")) {
        if (screenMode == 2 && ddrledState == 0) {// check for gencheck with card ddr.
            JOptionPane.showMessageDialog(this, "DDR4 not calibrated. Could not start the test.");
            return;
        }/*from  w  w  w  .  ja  va 2 s  . co  m*/
        // conditional check for min and max
        if (pathFied.getText().length() == 0) {
            Object[] options1 = { "Ok" };
            int s = JOptionPane.showOptionDialog(null, "Please choose Video file path", " ",
                    JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null);
            return;
        }
        if (Integer.parseInt(mincoeff.getValue().toString()) > Integer
                .parseInt(maxcoeff.getValue().toString())) {
            Object[] options1 = { "Ok" };
            int s = JOptionPane.showOptionDialog(null, "Min Threshold should always be less than Max Threshold",
                    " ", JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null);
            return;
        }
        messageLog2.append(">> Test Started\n");
        videoPauseButton.setEnabled(true);
        videoPauseButton.setText("Pause");
        videoplayButton.setText("Stop");
        pathFied.setEnabled(false);
        browseButton.setEnabled(false);
        //            mincoeff.setEnabled(false);
        //            maxcoeff.setEnabled(false);
        //            invertcheckbox.setEnabled(false);
        testStarted = true;

        di.startVideoTest(0, 7, Integer.parseInt(mincoeff.getValue().toString()),
                Integer.parseInt(maxcoeff.getValue().toString()), invertcheckbox.isSelected() ? 1 : 0, 7680);
        BGWorker worker = new BGWorker("./util/run_all_vlc.sh" + " start " + pathFied.getText());
        worker.execute();
        try {
            Thread.sleep(500);
        } catch (InterruptedException ex) {
            Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        }

    } else {
        testStarted = false;
        videoplayButton.setText("Start");
        videoPauseButton.setEnabled(false);
        BGWorker worker = new BGWorker("./kill_vlc.sh");
        worker.execute();

        pathFied.setEnabled(true);
        browseButton.setEnabled(true);
        //            mincoeff.setEnabled(true);
        //            maxcoeff.setEnabled(true);
        //            invertcheckbox.setEnabled(true);

        di.stopVideoTest(0, 7, 7680);

        axiTxTextField4.setText("0.000");
        axiRxTextField4.setText("0.000");
        //            ddrRxTextField.setText("0.000");
        //            ddrTxTextField.setText("0.000");

        pcieTxTextField4.setText("0.000");
        pcieRxTextField4.setText("0.000");
        messageLog2.append(">> Test Stopped\n");
        try {
            Thread.sleep(15000);
        } catch (InterruptedException ex) {
            Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

From source file:com.xilinx.ultrascale.gui.MainScreen_video.java

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

    // TODO add your handling code here:
    if (videoplayButton.getText().equalsIgnoreCase("Start")) {
        if (screenMode == 2 && ddrledState == 0) {// check for gencheck with card ddr.
            JOptionPane.showMessageDialog(this, "DDR4 not calibrated. Could not start the test.");
            return;
        }/* w  ww.  j av a 2  s . c o  m*/
        // conditional check for min and max
        if (pathFied.getText().length() == 0) {
            Object[] options1 = { "Ok" };
            int s = JOptionPane.showOptionDialog(null, "Please choose Video file path", " ",
                    JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null);
            return;
        }
        if (Integer.parseInt(mincoeff.getValue().toString()) > Integer
                .parseInt(maxcoeff.getValue().toString())) {
            Object[] options1 = { "Ok" };
            int s = JOptionPane.showOptionDialog(null, "Min Threshold should always be less than Max Threshold",
                    " ", JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null);
            return;
        }
        // showing the videos panel

        //videoFrame.setLocationRelativeTo(this);
        videoFrame.setVisible(true);
        frame1.setVisible(true);
        frame2.setVisible(true);
        rxMediaPlayer.getMediaPlayer().playMedia("v4l2:///dev/video0");

        di.startVideoTest(0, 7, Integer.parseInt(mincoeff.getValue().toString()),
                Integer.parseInt(maxcoeff.getValue().toString()), invertcheckbox.isSelected() ? 1 : 0, 7680);

        Timer timers = new java.util.Timer();
        timers.schedule(new TimerTask() {
            @Override
            public void run() {
                txMediaPlayer.getMediaPlayer().playMedia(pathFied.getText());
                txMediaPlayer.getMediaPlayer().setRepeat(true);
            }
        }, 2000);

        //            txMediaPlayer.setRate((float) 16.0);
        messageLog2.append(">> Test Started\n");
        videoPauseButton.setEnabled(true);
        videoPauseButton.setText("Pause");
        videoplayButton.setText("Stop");
        pathFied.setEnabled(false);
        browseButton.setEnabled(false);
        //            mincoeff.setEnabled(false);
        //            maxcoeff.setEnabled(false);
        //            invertcheckbox.setEnabled(false);
        testStarted = true;

        //BGWorker worker1 = new BGWorker("./run_receive_vlc.sh");
        //worker1.execute();
        //            pworker = new ProcessWorker("./run_receive_vlc.sh");
        //            pworker.execute();
        //            try {
        //                Thread.sleep(500);
        //            } catch (InterruptedException ex) {
        //                Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        //            }
        //            worker = new BGWorker("./util/run_vlc.sh" + " start " + pathFied.getText());
        //            worker.execute();
        //            try {
        //                Thread.sleep(500);
        //            } catch (InterruptedException ex) {
        //                Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        //            }
    } else {
        testStarted = false;
        videoplayButton.setText("Wait");
        videoPauseButton.setEnabled(false);
        di.stopVideoTest(0, 7, 7680);
        //            if (worker1 != null){
        //                worker1.cancel(true);
        //                worker1 = null;
        //            }
        //            
        //            if(worker != null){
        //                worker.cancel(true);
        //                worker = null;
        //            }
        //            BGWorker worker1 = new BGWorker("./util/run_vlc.sh exit");
        //            worker1.execute();

        //pworker.p.destroy();
        txMediaPlayer.getMediaPlayer().stop();
        rxMediaPlayer.getMediaPlayer().stop();
        videoFrame.setVisible(false);
        frame1.setVisible(false);
        frame2.setVisible(false);

        pathFied.setEnabled(true);
        browseButton.setEnabled(true);
        //            mincoeff.setEnabled(true);
        //            maxcoeff.setEnabled(true);
        //            invertcheckbox.setEnabled(true);

        axiTxTextField4.setText("0.000");
        axiRxTextField4.setText("0.000");
        //            ddrRxTextField.setText("0.000");
        //            ddrTxTextField.setText("0.000");

        pcieTxTextField4.setText("0.000");
        pcieRxTextField4.setText("0.000");
        messageLog2.append(">> Test Stopped\n");
        //            try {
        //                Thread.sleep(15000);
        //            } catch (InterruptedException ex) {
        //                Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        //            }
        // disable button until the vlc rec window close.
        videoplayButton.setEnabled(false);
        Timer timers = new java.util.Timer();
        timers.schedule(new TimerTask() {
            @Override
            public void run() {
                enablePlayButton();
            }
        }, 3000);
    }

}

From source file:interfaces.InterfazPrincipal.java

private void TablaDeBuscarFacturaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaDeBuscarFacturaMouseClicked
    int fila = TablaDeBuscarFactura.getSelectedRow();
    int identificacion = (int) TablaDeBuscarFactura.getValueAt(fila, 1);

    Object opciones[] = { "Imprimir", "Guardar", " Eliminar", "Cancelar" };

    int opcion = JOptionPane.showOptionDialog(this,
            "Que operacin desea realizar con la factura  " + identificacion + "?", "Mensaje del sistema",
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, opciones, null);
    GenerarFactura generarFactura = new GenerarFactura();
    switch (opcion) {
    case 0://  www. j ava 2 s.  c  o m
        generarFactura.imprimirFactura(identificacion, this);
        break;
    case 1:
        PDDocument documento = generarFactura.crearFactura(identificacion, this);
        JFileChooser fc = new JFileChooser();
        FileNameExtensionFilter filter = new FileNameExtensionFilter("Archivo PDF", "pdf", "text");
        fc.setFileFilter(filter);
        fc.showSaveDialog(this);
        if (fc.getSelectedFile() != null) {
            File selectedFile = fc.getSelectedFile();
            try {

                documento.save(selectedFile + ".pdf");
                JOptionPane.showMessageDialog(this, "El archivo ha sido guardado en disco");

            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this,
                        "El Archivo no se puede leer!\nInformacin tcnica\n" + ex.toString());
            }
            break;
        }

    case 2:
        int confirmacion = JOptionPane.showConfirmDialog(this,
                "Quieres eliminar la factura " + identificacion + " factura?");

        if (confirmacion == JOptionPane.YES_OPTION) {
            ControladorFactura controladorFactura = new ControladorFactura();
            controladorFactura.deleteFactura(" where factura_id = " + identificacion);
        }
        break;
    case 3:
        break;
    default:
        break;

    }

}