show Open Picture Dialog - Java Swing

Java examples for Swing:JOptionPane

Description

show Open Picture Dialog

Demo Code


//package com.java2s;
import javafx.stage.FileChooser;
import java.io.File;

public class Main {
    public static File showOpenPictureDialog() {
        final FileChooser fileChooser = new FileChooser();
        fileChooser.getExtensionFilters().addAll(
                new FileChooser.ExtensionFilter("Portable Network Graphic",
                        "*.png"));

        return fileChooser.showOpenDialog(null);
    }/*  w ww.  j a v  a2  s  .c  o m*/
}

Related Tutorials