Examples of FileChooser


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

Examples of com.eastmountain.chinese.gui.FileChooser

        System.out.println( "****** HZFlashcardsDataModel.saveList() invoked" );

        if ( ! ( chineseElementProperties  == null ) ) {

            FileChooser fileChooser = new FileChooser();

            int returnVal = fileChooser.showSaveDialog( null );

            if ( returnVal == JFileChooser.APPROVE_OPTION) {

                outputFile = fileChooser.getSelectedFile().getName();

                writeXML( chineseElementProperties, outputFile );

                System.out.println( "\nOpening: " + outputFile + "\n" );

View Full Code Here

Examples of com.lightcrafts.platform.FileChooser

        add(new JScrollPane(list));

        updateFromTemplates();

        // Import and Export need file choosers.
        final FileChooser chooser = Platform.getPlatform().getFileChooser();

        importButton = new JButton(LOCALE.get("TemplateImportButton"));
        importButton.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    Frame frame = getAncestorFrame();
                    File dir = getRecentImportDir();
                    FilenameFilter lztFilter = new FilenameFilter() {
                        public boolean accept(File file, String name) {
                            return name.toLowerCase().endsWith(".lzt");
                        }
                    };
                    File file = chooser.openFile(
                        LOCALE.get("TemplateImportDialogTitle"),
                        dir, frame, lztFilter
                    );
                    if (file != null) {
                        importTemplate(file);
                        setRecentImportDir(file.getParentFile());
                    }
                }
            }
        );
        exportButton = new JButton(LOCALE.get("TemplateExportButton"));
        exportButton.setEnabled(false);
        exportButton.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    Frame frame = getAncestorFrame();
                    File dir = getRecentExportDir();
                    File file = chooser.chooseDirectory(
                        LOCALE.get("TemplateExportDialogTitle"),
                        dir, frame, false
                    );
                    if (file != null) {
                        exportTemplates(file);
View Full Code Here

Examples of com.lightcrafts.platform.FileChooser

        );
        dirButton.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    Platform platform = Platform.getPlatform();
                    FileChooser chooser = platform.getFileChooser();
                    File directory = chooser.chooseDirectory(
                        LOCALE.get("SendDialogChooserTitle"),
                        conf.directory, SendDialog.this, false
                    );
                    if (directory != null) {
                        conf.directory = directory;
View Full Code Here

Examples of com.lightcrafts.platform.FileChooser

            }
        );
        search.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    FileChooser chooser = Env.getFileChooser();
                    file = chooser.openFile(
                        findTitle, chooserFile, parent,
                        ImageFilenameFilter.INSTANCE
                    );
                    if (file != null) {
                        dialog.dispose();
View Full Code Here

Examples of com.lightcrafts.platform.FileChooser

        );
        if (result == 0) {  // Use this image
            file = newImageFile;
        }
        else if (result == 1) { // Search for the image
            FileChooser chooser = Env.getFileChooser();
            String title = LOCALE.get(
                "ImageSelectorFindDialogTitle", oldImageFile.getName()
            );
            file = chooser.openFile(
                title, chooserFile, parent, ImageFilenameFilter.INSTANCE
            );
        }
        else {
            file = null;    // Cancel
View Full Code Here

Examples of com.lightcrafts.platform.FileChooser

            AlertDialog.ERROR_ALERT,
            LOCALE.get("ImageSelectorSearchOption"),
            LOCALE.get("ImageSelectorCancelOption")
        );
        if (result == 0) {  // Yes, please search
            FileChooser chooser = Env.getFileChooser();
            String title = LOCALE.get(
                "ImageSelectorFindDialogTitle", oldImageFile.getName()
            );
            file = chooser.openFile(
                title, chooserFile, parent, ImageFilenameFilter.INSTANCE
            );
        }
        else {
            file = null;    // Cancel
View Full Code Here

Examples of com.lightcrafts.platform.FileChooser

        );
        dirButton.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    Platform platform = Platform.getPlatform();
                    FileChooser chooser = platform.getFileChooser();
                    File directory = chooser.chooseDirectory(
                        LOCALE.get("BatchConfOutputChooserDialogTitle"),
                        config.directory, dialog, false
                    );
                    if (directory != null) {
                        config.directory = directory;
View Full Code Here

Examples of com.lightcrafts.platform.FileChooser

        }
    }

    // Conduct the dialog to accept a new color profile.
    public void actionPerformed(ActionEvent event) {
        FileChooser chooser = Platform.getPlatform().getFileChooser();
        AlertDialog alert = Platform.getPlatform().getAlertDialog();
        String path;
        if (text.isEnabled()) {
            path = text.getText();
        }
        else {
            path = System.getProperty("user.home");
        }
        File file = new File(path);
        file = chooser.openFile(
            "Display Color Profile", file, null, null
        );
        if (file != null) {
            if (! file.isFile()) {
                alert.showAlert(
View Full Code Here

Examples of com.lightcrafts.platform.FileChooser

        chooserButton.setToolTipText(LOCALE.get("ScratchFileItemToolTip"));

        chooserButton.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    FileChooser chooser =
                        Platform.getPlatform().getFileChooser();
                    String path = text.getText();
                    File dir = new File(path);
                    Window window = (Window) SwingUtilities.getAncestorOfClass(
                        Window.class, chooserButton
                    );
                    dir = chooser.chooseDirectory(
                        LOCALE.get("ScratchFileDialogTitle"), dir, window, true
                    );
                    if (dir != null) {
                        if (! dir.isDirectory()) {
                            dir = dir.getParentFile();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.