Example usage for java.awt Desktop getDesktop

List of usage examples for java.awt Desktop getDesktop

Introduction

In this page you can find the example usage for java.awt Desktop getDesktop.

Prototype

public static synchronized Desktop getDesktop() 

Source Link

Document

Returns the Desktop instance of the current desktop context.

Usage

From source file:GUI.MainWindow.java

private void handleCVELookup(File save_file) {

    final File sf = save_file;
    // Best to do this as a background task it'll take time
    Runnable r = new Runnable() {
        public void run() {
            HashSet cves = new HashSet();
            // Find all selected vulns in the tree.
            TreePath[] paths = VulnTree.getSelectionPaths();
            for (int i = 0; i < paths.length; i++) {
                // Loop through them and merge all CVEs into the cves HashSet
                TreePath path = paths[i];
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
                Object obj = node.getUserObject();
                if (obj instanceof Vulnerability) {
                    Vulnerability vuln = (Vulnerability) obj;
                    // add these references to the HashSet
                    cves.addAll(vuln.getCVEReferences());
                }/*w  ww  . j  ava  2s . c  o  m*/
            }

            // Get the answers from our local CSV file
            CVEUtils cveu = new CVEUtils();
            Vector answers = cveu.getCVEs(cves);

            try {
                String[] headerrow = { "CVE ID", "Risk Score", "Summary" };
                // Write header column to file
                writeCSVLine(sf, headerrow);
                // Now get all the details and make a CSV for the user.
                Enumeration enums = answers.elements();
                while (enums.hasMoreElements()) {
                    CVE c = (CVE) enums.nextElement();
                    System.out.println(c.getCveId() + ":" + c.getRiskScore());
                    writeCSVLine(sf, c.toStringArray());
                }

                // Open file in user's default programme
                Desktop.getDesktop().open(sf);

            } catch (Exception ex) {
                JOptionPane.showMessageDialog(null, ex.getMessage());
            }
        }
    };

    new Thread(r).start();
}

From source file:client.welcome2.java

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

    String filename_show_report = "src/ProjectReports/" + sFileName;
    try {/* w ww . ja v  a2  s  .c  o  m*/

        Desktop.getDesktop().open(new File(filename_show_report));
    }

    catch (Exception e) {
        JOptionPane.showMessageDialog(null, "The Report Generetad Wasn't Found", "Error",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:com.nikonhacker.gui.EmulatorUI.java

private void showAboutDialog() {
    // for copying style
    JLabel label = new JLabel();
    Font font = label.getFont();//from   ww w  . j av  a2 s. c  om

    // create some css from the label's font
    String style = "font-family:" + font.getFamily() + ";" + "font-weight:"
            + (font.isBold() ? "bold" : "normal") + ";" + "font-size:" + font.getSize() + "pt;";

    // html content
    JEditorPane editorPane = new JEditorPane("text/html", "<html><body style=\"" + style + "\">"
            + "<font size=\"+1\">" + ApplicationInfo.getNameVersion() + "</font><br/>"
            + "<i>A dual (Fujitsu FR + Toshiba TX) microcontroller emulator in Java, aimed at mimicking the behaviour of Nikon DSLRs</i><br/>"
            + "<font size=\"-2\">Built on " + ApplicationInfo.getBuildTime() + "</font><br/><br/>"
            + "This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.<br/>"
            + "This software is provided under the GNU General Public License, version 3 - "
            + makeLink("http://www.gnu.org/licenses/gpl-3.0.txt") + "<br/>"
            + "This software is based on, or makes use of, the following works:<ul>\n"
            + "<li>Simeon Pilgrim's deciphering of firmware encoding and lots of information shared on his blog - "
            + makeLink("http://simeonpilgrim.com/blog/") + "</li>"
            + "<li>Dfr Fujitsu FR diassembler Copyright (c) Kevin Schoedel - "
            + makeLink("http://scratchpad.wikia.com/wiki/Disassemblers/DFR")
            + "<br/>and its port to C# by Simeon Pilgrim</li>"
            + "<li>\"How To Write a Computer Emulator\" article by Marat Fayzullin - "
            + makeLink("http://fms.komkon.org/EMUL8/HOWTO.html") + "</li>"
            + "<li>The PearColator x86 emulator project - "
            + makeLink("http://apt.cs.man.ac.uk/projects/jamaica/tools/PearColator/") + "</li>"
            + "<li>The Jacksum checksum library Copyright (c) Dipl.-Inf. (FH) Johann Nepomuk Lfflmann  - "
            + makeLink("http://www.jonelo.de/java/jacksum/") + "</li>"
            + "<li>HexEditor & RSyntaxTextArea swing components, Copyright (c) Robert Futrell - "
            + makeLink("http://fifesoft.com/hexeditor/") + "</li>"
            + "<li>JGraphX graph drawing library, Copyright (c) JGraph Ltd - "
            + makeLink("http://www.jgraph.com/jgraph.html") + "</li>"
            + "<li>Apache commons libraries, Copyright (c) The Apache Software Foundation - "
            + makeLink("http://commons.apache.org/") + "</li>"
            + "<li>VerticalLayout, Copyright (c) Cellspark - " + makeLink("http://www.cellspark.com/vl.html")
            + "</li>" + "<li>MigLayout, Copyright (c) MigInfoCom - " + makeLink("http://www.miginfocom.com/")
            + "</li>" + "<li>Glazed Lists, Copyright (c) 2003-2006, publicobject.com, O'Dell Engineering Ltd - "
            + makeLink("http://www.glazedlists.com/") + "</li>"
            + "<li>Samples from the Java Tutorial (c) Sun Microsystems / Oracle - "
            + makeLink("http://docs.oracle.com/javase/tutorial") + "</li>"
            + "<li>MARS, MIPS Assembler and Runtime Simulator (c) 2003-2011, Pete Sanderson and Kenneth Vollmar - "
            + makeLink("http://courses.missouristate.edu/KenVollmar/MARS") + "</li>"
            + "<li>SteelSeries (and SteelCheckBox) Swing components (c) 2010, Gerrit Grunwald - "
            + makeLink("http://harmoniccode.blogspot.be/search/label/steelseries") + "</li>" + "</ul>"
            + "License terms for all included code are available in the 'licenses' folder of the distribution."
            + "<p>For more information, help or ideas, please join us at " + makeLink("http://nikonhacker.com")
            + "</p></body></html>");

    // handle link events
    editorPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                try {
                    Desktop.getDesktop().browse(e.getURL().toURI());
                } catch (Exception e1) {
                    // noop
                }
            }
        }
    });
    editorPane.setEditable(false);
    Color greyLayer = new Color(label.getBackground().getRed(), label.getBackground().getGreen(),
            label.getBackground().getBlue(), 192);
    editorPane.setBackground(greyLayer);
    //editorPane.setOpaque(false);

    // show
    //        JOptionPane.showMessageDialog(this, editorPane, "About", JOptionPane.PLAIN_MESSAGE);

    final JDialog dialog = new JDialog(this, "About", true);

    JPanel contentPane = new BackgroundImagePanel(new BorderLayout(),
            Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_full.jpg")));
    contentPane.add(editorPane, BorderLayout.CENTER);

    JButton okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            dialog.dispose();
        }
    });
    JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    bottomPanel.add(okButton);
    bottomPanel.setBackground(greyLayer);
    // bottomPanel.setOpaque(false);

    contentPane.add(bottomPanel, BorderLayout.SOUTH);

    dialog.setContentPane(contentPane);
    dialog.pack();
    dialog.setLocationRelativeTo(this);
    dialog.setResizable(false);
    dialog.setVisible(true);
}

From source file:osu.beatmapdownloader.JFrame.java

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
       try {//from w  w w  . ja  va  2 s.co  m
           Desktop.getDesktop()
                   .browse(new URI("https://github.com/GarciaMiguelangel/Osu-Masive-Beatmap-Downloader/wiki"));
       } catch (Exception e) {
           errorFatal("To Git");
           errorFatal(e.toString());
           errorFatal("--------------------------------------");
       }
   }

From source file:mesquite.lib.MesquiteModule.java

public static void showWebPage(String path, boolean autoCompose, boolean removePastNumberSign) {
    if (path != null) {
        if (MesquiteTrunk.isApplet()) {
            //TODO: FILL THIS IN
        } else {//from w ww.j  av  a2 s  . c  o m
            String pathToCheck = path;
            if (path.indexOf("#") > 0 && removePastNumberSign)
                pathToCheck = StringUtil.getAllButLastItem(path, "#");
            path = pathToCheck; //Todo: this is temporary, as the launching methods don't seem to handle within-page anchors
            String[] browserCommand = null;
            boolean remote = path.indexOf(":/") >= 0;

            boolean useDesktop = false;
            if (MesquiteTrunk.getJavaVersionAsDouble() >= 1.6) { // let's check to see if this will work first
                try {
                    if (Desktop.isDesktopSupported()) {
                        Desktop desktop = Desktop.getDesktop();
                        if (desktop.isSupported(Desktop.Action.BROWSE)) {
                            useDesktop = true;
                        }
                    }
                } catch (Exception e) {
                }
            }

            if (useDesktop) {
                Desktop d = Desktop.getDesktop();
                try {
                    URI uri = null;
                    if (path.indexOf("http:/") < 0 && path.indexOf("https:/") < 0) { // it's a local reference
                        File file = new File(path);
                        uri = file.toURI();
                    } else
                        uri = new URI(path);
                    if (!remote && !CommandChecker.documentationComposed && autoCompose) {
                        CommandChecker checker = new CommandChecker();
                        checker.composeDocumentation();
                    }
                    d.browse(uri);
                } catch (IOException e) {
                    browserString = null;
                    MesquiteTrunk.mesquiteTrunk.alert(
                            "The requested page could not be shown, because the web browser could not be used properly.  There may be a problem with insufficient memory or the location of the web page or browser.");
                } catch (URISyntaxException e) {
                    MesquiteTrunk.mesquiteTrunk.alert(
                            "The requested page could not be shown, because the address was not interpretable.");
                }
            } else if (MesquiteTrunk.isMacOSX()) { //Mac OS X
                if (remote) { //remote OSX file, use browser laucher
                    try {
                        BrowserLauncher.openURL(path);
                    } catch (IOException e) {
                        browserString = null;
                        MesquiteTrunk.mesquiteTrunk.alert(
                                "The requested page could not be shown, because the web browser could not be used properly.  There may be a problem with insufficient memory or the location of the web page or browser.");
                    }
                    return;
                } else {
                    if (!remote && !CommandChecker.documentationComposed && autoCompose) {
                        CommandChecker checker = new CommandChecker();
                        checker.composeDocumentation();
                    }
                    File testing = new File(pathToCheck);
                    if (!testing.exists()) {
                        MesquiteTrunk.mesquiteTrunk.alert(
                                "The requested page could not be shown, because the file could not be found. ("
                                        + pathToCheck + ")");
                        return;
                    }
                    if (!CommandChecker.documentationComposed && autoCompose) {
                        CommandChecker checker = new CommandChecker();
                        checker.composeDocumentation();
                    }
                    browserString = "open";
                    String brs = "Safari.app";
                    File br = new File("/Applications/Safari.app");
                    if (!br.exists())
                        brs = "Firefox.app";
                    if (!br.exists())
                        brs = "Internet Explorer.app";

                    String[] b = { browserString, "-a", brs, path };

                    browserCommand = b;
                    try {
                        //String[] browserCommand = {browserString, arg1, arg2, arg3};
                        //if (MesquiteTrunk.isMacOSXLeopard())  //bug in 10.5 occasionally prevented Safari from starting
                        //   Runtime.getRuntime().exec(new String[]{browserString, "-a", brs});
                        Runtime.getRuntime().exec(browserCommand);
                    } catch (IOException e) {
                        browserString = null;
                        MesquiteTrunk.mesquiteTrunk.alert(
                                "The requested page could not be shown, because the web browser could not be used properly.  There may be a problem with insufficient memory or the location of the web page or browser.");
                    }
                }
            } else {

                try {
                    BrowserLauncher.openURL(path);
                    return;
                } catch (IOException e) {
                }
                if (!remote) {//local file
                    File testing = new File(pathToCheck);
                    if (!testing.exists()) {
                        MesquiteTrunk.mesquiteTrunk.alert(
                                "The requested page could not be shown, because the file could not be found.");
                        return;
                    }
                    path = MesquiteFile.massageFilePathToURL(path);
                }
                browserString = MesquiteFile.checkFilePath(browserString, "Please select a web browser.");
                if (StringUtil.blank(browserString)) {
                    browserString = MesquiteString.queryString(mesquiteTrunk.containerOfModule(),
                            "Enter browser path",
                            "If you wish, enter the path to the browser (E.g., /hard_disk/programs/myBrowser.exe)",
                            "");
                    if (StringUtil.blank(browserString))
                        return;
                }
                String[] b = { browserString, path };
                browserCommand = b;
                try {
                    //String[] browserCommand = {browserString, arg1, arg2, arg3};

                    Runtime.getRuntime().exec(browserCommand);
                } catch (IOException e) {
                    browserString = null;
                    MesquiteTrunk.mesquiteTrunk.alert(
                            "The requested page could not be shown, because the web browser could not be used properly.  There may be a problem with insufficient memory or the location of the web page or browser.");
                }
            }
        }
    }
}

From source file:client.welcome2.java

private void showRepSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showRepSearchButtonActionPerformed
    String fn = "src/ProjectReports/" + sFileName;
    try {// www .  j ava2s .co m

        Desktop.getDesktop().open(new File(fn));
    }

    catch (Exception e) {
        JOptionPane.showMessageDialog(null, e);
    }
}

From source file:jeplus.JEPlusFrameMain.java

private void jMenuItemViewFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemViewFolderActionPerformed
    if (Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {
        try {//from ww  w.ja va 2 s . c om
            File output = new File(BatchManager.getResolvedEnv().getParentDir());
            if (output.exists()) {
                Desktop.getDesktop().open(output);
            } else {
                JOptionPane.showMessageDialog(this,
                        "Output folder " + output.getAbsolutePath() + " does not exist.");
            }
        } catch (IOException ex) {
            logger.error("Failed to open folder " + BatchManager.getResolvedEnv().getParentDir(), ex);
        }
    } else {
        JOptionPane.showMessageDialog(this,
                "Open folder is not supported, or the current job record is not valid.", "Operation failed",
                JOptionPane.CLOSED_OPTION);
    }

}

From source file:Form.Principal.java

public void PanelFacturas() {
    int i = 0;/* w w  w  .  java2 s .co  m*/
    int Altura = 0;
    Color gris = new Color(44, 44, 44);
    Color azul = new Color(0, 153, 255);
    Color rojo = new Color(221, 76, 76);
    try {
        //Consultamos todos los clientes
        ResultSet Comandos = Funcion.Select(st,
                "SELECT factura_emitida.*, cliente.*  FROM cliente,factura_emitida  WHERE factura_emitida.idCliente = cliente.idCliente;");
        //Ciclo para crear un panel para cada uno
        while (Comandos.next()) {
            Variables.Comentario = Comandos.getString("Observaciones");
            //Creamos un panel con alineacion a la izquierda
            JPanel Panel = new JPanel();
            Panel.setLayout(null);
            jPanel11.add(Panel);
            //Tamao del panel
            Panel.setSize(680, 200);
            // La posicion y del panel ira incrementando para que no se encimen
            Altura = 30 + (i * 250);
            Panel.setLocation(50, Altura);
            Panel.setBackground(Color.white);
            Panel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
            //Creamos label para mostrar los datos del cliente, el codigo html es para que al llegar al final del panel
            //se pase a la siguiente linea y para el margen izquierdo

            JLabel FolioFactura = new JLabel();
            FolioFactura.setText("Folio de factura: " + Comandos.getString("idFacturaEmitida"));
            JLabel RFC = new JLabel();
            RFC.setText("RFC: " + Comandos.getString("RFC"));
            JLabel Nombre = new JLabel();
            Nombre.setText("Nombre: " + Comandos.getString("NombreCliente"));
            JLabel Direccion = new JLabel();
            Direccion.setText("Direccion: " + Comandos.getString("Direccion"));
            JLabel Correo = new JLabel();
            Correo.setText("Correo: " + Comandos.getString("correo"));
            JLabel Fecha = new JLabel();
            Fecha.setText("Fecha y Hora de emisin: " + Comandos.getString("FechaEmision"));

            JButton Abre = new JButton();
            Abre.setText("Abrir");
            Abre.setName(Comandos.getString("idFacturaEmitida"));
            Abre.setBackground(azul);
            JButton Cancelar = new JButton();
            Cancelar.setText("Cancelar");
            Cancelar.setName(Comandos.getString("idFacturaEmitida"));
            Cancelar.setBackground(rojo);
            MouseListener mlAbre = new MouseListener() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    //System.out.println("Released!");
                }

                @Override
                public void mousePressed(MouseEvent e) {
                    //System.out.println("Pressed!");
                }

                @Override
                public void mouseExited(MouseEvent e) {
                    //System.out.println("Exited!");
                }

                @Override
                public void mouseEntered(MouseEvent e) {
                    //System.out.println("Entered!");
                }

                @Override
                public void mouseClicked(MouseEvent e) {
                    try {
                        JButton source = (JButton) e.getSource();
                        idFacClien = Integer.parseInt(source.getName());
                        ResultSet Comandos = Funcion.Select(st,
                                "SELECT *FROM factura_emitida  WHERE idfacturaEmitida=" + idFacClien + ";");
                        while (Comandos.next()) {
                            Variables.FechaFactura = Comandos.getString("FechaEmision");
                            Variables.FechaSistema = Comandos.getString("fechasistema");
                            Variables.idFactura = Comandos.getInt("idFacturaEmitida");
                        }
                        Consulta();
                        Variables.guardar = false;
                        NuevoPdf pdf = new NuevoPdf("Factura.pdf");
                        pdf.main();
                        File myfile = new File("Factura.pdf");
                        Desktop.getDesktop().open(myfile);
                        Comandos = Funcion.Select(st, "SELECT * FROM factura_emitida;");
                        try {
                            if (Comandos.next()) {
                                Comandos.last();
                                Variables.idFactura = Comandos.getInt("idFacturaEmitida") + 1;
                            } else {
                                Variables.idFactura = 1;
                            }
                        } catch (SQLException ex) {
                            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    } catch (Exception ex) {
                        Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            };
            MouseListener mlCancelar = new MouseListener() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    //System.out.println("Released!");
                }

                @Override
                public void mousePressed(MouseEvent e) {
                    //System.out.println("Pressed!");
                }

                @Override
                public void mouseExited(MouseEvent e) {
                    //System.out.println("Exited!");
                }

                @Override
                public void mouseEntered(MouseEvent e) {
                    //System.out.println("Entered!");
                }

                @Override
                public void mouseClicked(MouseEvent e) {
                    JButton source = (JButton) e.getSource();
                    Variables.Cancelar = Integer.parseInt(source.getName());
                    String Comando = "UPDATE factura_emitida SET Observaciones='Factura Cancelada' WHERE idFacturaEmitida="
                            + Variables.Cancelar + ";";
                    Funcion.Update(st, Comando);
                    jPanel11.removeAll();
                    PanelFacturas();
                    jPanel11.repaint();
                }
            };
            Abre.addMouseListener(mlAbre);
            Cancelar.addMouseListener(mlCancelar);
            //Fuente del texto;
            FolioFactura.setFont(new Font("Verdana", Font.PLAIN, 13));
            FolioFactura.setForeground(gris);
            RFC.setFont(new Font("Verdana", Font.PLAIN, 13));
            RFC.setForeground(gris);
            Nombre.setFont(new Font("Verdana", Font.PLAIN, 13));
            Nombre.setForeground(gris);
            Direccion.setFont(new Font("Verdana", Font.PLAIN, 13));
            Direccion.setForeground(gris);
            Correo.setFont(new Font("Verdana", Font.PLAIN, 13));
            Correo.setForeground(gris);
            Fecha.setFont(new Font("Verdana", Font.PLAIN, 13));
            Fecha.setForeground(gris);
            /// Botones
            Abre.setFont(new Font("Verdana", Font.PLAIN, 15));
            Abre.setForeground(Color.white);
            Cancelar.setFont(new Font("Verdana", Font.PLAIN, 15));
            Cancelar.setForeground(Color.white);
            //Aadimos los label al panel correspondiente del cliente
            Panel.add(FolioFactura);
            Panel.add(RFC);
            Panel.add(Nombre);
            Panel.add(Direccion);
            Panel.add(Correo);
            Panel.add(Fecha);
            Panel.add(Abre);

            FolioFactura.setLocation(15, 5);
            FolioFactura.setSize(400, 45);

            RFC.setLocation(15, 25);
            RFC.setSize(400, 45);

            Nombre.setLocation(15, 45);
            Nombre.setSize(500, 45);

            Direccion.setLocation(15, 65);
            Direccion.setSize(650, 45);

            Correo.setLocation(15, 85);
            Correo.setSize(500, 45);

            Fecha.setLocation(15, 105);
            Fecha.setSize(500, 45);
            /// Botones Tamao y localizacion
            if (Variables.Tipo.equalsIgnoreCase("Administrador")) { // Verificamos que sea un Administrador
                Panel.add(Cancelar);
                Abre.setLocation(185, 160);
                Abre.setSize(120, 30);
                Cancelar.setLocation(350, 160);
                Cancelar.setSize(120, 30);

                if (Variables.Comentario.equalsIgnoreCase("Factura Cancelada")) {
                    Cancelar.setVisible(false);
                    Abre.setLocation(290, 160);
                    Abre.setSize(120, 30);
                }

            } else {
                Abre.setLocation(290, 160);
                Abre.setSize(120, 30);
            }

            i++;
        }
    } catch (SQLException ex) {
        Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
    }
    //Dependiendo de cuantos clientes se agregaron, se ajusta el tamao del panel principal para que el scroll llegue hasta ahi
    jPanel11.setPreferredSize(new Dimension(jPanel11.getWidth(), Altura + 300));

}

From source file:uk.sipperfly.ui.Exactly.java

private void aboutAreaHyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_aboutAreaHyperlinkUpdate
    if (HyperlinkEvent.EventType.ACTIVATED.equals(evt.getEventType())) {
        System.out.println(evt.getURL());
        Desktop desktop = Desktop.getDesktop();
        try {/* ww  w.j  a va2s  . c  o m*/
            desktop.browse(evt.getURL().toURI());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

From source file:uk.sipperfly.ui.Exactly.java

private void authorAreaHyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_authorAreaHyperlinkUpdate
    if (HyperlinkEvent.EventType.ACTIVATED.equals(evt.getEventType())) {
        System.out.println(evt.getURL());
        Desktop desktop = Desktop.getDesktop();
        try {/*from ww  w .j  a  v a  2s .c om*/
            desktop.browse(evt.getURL().toURI());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}