package com.soft.test;
import javax.swing.*;
import javax.swing.filechooser.*;
import java.awt.event.*;
import java.io.FileFilter;
public class SplashDemo extends JFrame implements ActionListener {
private JButton jb = null;
public SplashDemo() {
jb = new JButton("打开");
jb.addActionListener(this);
this.add(jb);
this.setSize(, );
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
public static void main(String[] args) {
SplashDemo s = new SplashDemo();
}
public void actionPerformed(ActionEvent e) {
JFileChooser jf = new JFileChooser();
jf.setToolTipText("打开");
FileNameExtensionFilter ff = new FileNameExtensionFilter(
"图像文件(jpg/gif)", "jpg", "jpeg", "gif");
jf.setFileFilter(ff);
jf.showOpenDialog(this);
}
}