Package carcel.dialogs

Examples of carcel.dialogs.FileChooser


        });

        cargarFotoButt.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                FileChooser chooser = new FileChooser();
                int returnVal = chooser.showOpenDialog(PresoController.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    try {
                        File file = chooser.getSelectedFile();
                        if (file.exists()) {
                            System.out.println("File " + file.getPath());
                            fotoPersonal = new ImageIcon(file.getPath());
                            if (fotoPersonal.getIconHeight() <= ICON_HEIGHT && fotoPersonal.getIconWidth() <= ICON_WIDTH) {
                                fotoLabel.setIcon(fotoPersonal);
                                InputStream fis = new FileInputStream(file);
                                bufferFoto = new byte[(int) file.length()];
                                int readers = fis.read(bufferFoto);
                                System.out.println("Hola");
                            } else {
                                MessageGenerator.showWarningMsj("Imagen", "La imagen es muy grande");
                            }
                        }
                    } catch (IOException ex) {
                        Logger.getLogger(PresoController.class.getName()).log(Level.SEVERE, null, ex);
                    }

                }

            }
        });


        cargarHuellaBt.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                FileChooser chooser = new FileChooser();
                int returnVal = chooser.showOpenDialog(PresoController.this);

                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = chooser.getSelectedFile();
                    //This is where a real application would open the file.
                    System.out.println("File " + file.getPath());

                    if (file.exists()) {
                        System.out.println("Tamaño " + file.length());
View Full Code Here

TOP

Related Classes of carcel.dialogs.FileChooser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.