图片浏览器(java版)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
图片浏览器
(后面附有完整代码)
一、需求分析
1、首先。
因为要显示图片所以要先有一个界面;用JFrame;
2、因为要能显示选定文件夹内的图片,所以要有一个文件夹选择器;用JTree;
3、显示图片的滚动面板;用JScrollPane;
4、因为要对图片进行分类,所以要设计分类模块;
5、因为要对图片进行备份,所以要设计备份模块;
6、因为要对图片进行幻灯播放,所以要设计幻灯播放模块;
二、概要设计
本次课程设计模块图、系统流程图:
三、运行环境、开发语言
操作系统:Windows XP 专业版 32位 SP3 ( DirectX 9.0c )
开发工具:MyEclipse
开发语言:java
四、详细设计
1 程序清单
String pt;鼠标点击的图片的绝对路径
File[] files2;面板上正在显示的图片文件
JLabel[] imageLabel;图片绑定的JLabel控件组
JLabel jlabel,jimageLabel; 图片绑定的JLabel控件JPanel jp1,jp2,jp3;显示不同内容的面板
JButton[] jb;按钮数组
private JTree tree;文件夹选择树
private JScrollPane jsp1,jsp2,jsp3;滚动面板
Timer timer;计时器
public PictureDir()类的构造函数
WindowAction窗体事件
TreeSelect文件夹选择树事件
FileDidianListener分类为地点事件FileRenwuListener分类为人物事件FileXiangceListener分类为相册事件
FileQitaListener分类为其它事件
FileZipListener备份事件
FileBackListener还原事件
MouseAction鼠标点击事件
FileStartListener幻灯片播放事件
JCAction显示分类图片事件
read(String)读文件函数
save(String,String)写文件函数
unzip(String,String)解压缩函数
resizeIcon(ImageIcon,JLabel)控制图片显示大小的函数deleteFile(File)删除文件函数
main(String[])主函数
2 主要代码
整个程序的界面如下图:
2.1 选择文件夹功能
class TreeSelect implements TreeSelectionListener{
public void valueChanged(TreeSelectionEvent e) {
TreePath path=e.getPath();
DefaultMutableTreeNode
node=(DefaultMutableTreeNode)path.getLastPathComponent();
Object userObject=node.getUserObject();
if(!(userObject instanceof File)){
return;
}
File folder=(File)userObject;
if(!folder.isDirectory())
return;
File[] files1=initImageSets1(folder);
for(File file:files1){
node.add(new DefaultMutableTreeNode(file));
}
files2=initImageSets2(folder);
for(int i=0;i<imageLabel.length;i++){
imageLabel[i].setIcon(null);
imageLabel[i].setBorder(null);
}
for(int i=0;i<files2.length;i++){
imageLabel[i].setIcon(new
ImageIcon(files2[i].toString()));
imageLabel[i].addMouseListener(new MouseAction());
imageLabel[i].setName(String.valueOf(i));
resizeIcon(new
ImageIcon(files2[i].toString()),imageLabel[i]);
}
}
private File[] initImageSets1(File pictureDir){
return pictureDir.listFiles(new FilenameFilter(){
public boolean accept(File dir,String name){
if(!new File(dir,name).isFile())
return true;
else
return false;
}
});
}
private File[] initImageSets2(File pictureDir){
return pictureDir.listFiles(new FilenameFilter(){
public boolean accept(File dir,String name){
if(!new File(dir,name).isFile())
return false;
String lowserName=name.toLowerCase();
if(lowserName.endsWith("jpg")||lowserName.endsWith("jpeg") ||lowserName.endsWith("gif")||lowserName.endsWith("png")
||lowserName.endsWith("GIF")||lowserName.endsWith("TIFF")
||lowserName.endsWith("ICO")||lowserName.endsWith("BMP")){
return true;
}
return false;
}
});
}
}
结果:
2.2图片分类功能
class FileDidianListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
try {
save(pt,"didian.txt");
JOptionPane.showMessageDialog(null,"分类为“地点”完成!");
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
class FileRenwuListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
try {
save(pt,"renwu.txt");
JOptionPane.showMessageDialog(null,"分类为“人物”完成!");
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
private DefaultMutableTreeNode rootNode;
class FileXiangceListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
try {
save(pt,"xiangce.txt");
JOptionPane.showMessageDialog(null,"分类为“相册”完成!");
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
class FileQitaListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
try {
save(pt,"qita.txt");
JOptionPane.showMessageDialog(null,"分类为“其它”完成!");
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
结果:
2.3图片备份和还原功能
class FileZipListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
try {
int a=0;
File file1=new File(pt);
File file2=new File("imagesdata.zip");
File f=new File("D:/1/3/5");
f.mkdirs();
if(!file2.exists()){
file2.createNewFile();
a=1;
}
else
unzip("imagesdata.zip","D:/1/3/5");
FileOutputStream fos= new FileOutputStream(file2);
ZipOutputStream zos=new ZipOutputStream(fos);
byte[] buffer=new byte[1024];
if(a==0){
File[] files=f.listFiles();
File[] filess=new File[files.length+1];
for(int i=0;i<files.length;i++){
filess[i]=files[i];
}
filess[filess.length-1]=file1;
for (int i = 0; i < filess.length; i++) {
String[] st=filess[i].getName().split(".");
for(int j=0;j<st.length;j++){
JOptionPane.showMessageDialog(null,j+"="+st[j]);
}
ZipEntry entry=new ZipEntry(new
Date().getTime()+filess[i].getName());
FileInputStream in = new
FileInputStream(filess[i]);
zos.putNextEntry(entry);
int len;
while ( (len = in.read(buffer)) > 0) {
zos.write(buffer, 0, len);
}
zos.closeEntry();
in.close();
}
}
if(a==1){
ZipEntry entry=new ZipEntry(new
Date().getTime()+file1.getName());
FileInputStream fis=new FileInputStream(file1);
zos.putNextEntry(entry);
int read=0;
while((read=fis.read(buffer))!=-1){
zos.write(buffer,0,read);
}
zos.closeEntry();
fis.close();
}
zos.close();
fos.close();
JOptionPane.showMessageDialog(null,"备份完成!");
deleteFile(f);
} catch (Exception e1) {
e1.printStackTrace();
JOptionPane.showMessageDialog(null,"备份失败!");
File f=new File("D:/1/2/3");
deleteFile(f);
}
}
}
class FileBackListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
JFileChooser chooser1;
chooser1=new JFileChooser();
chooser1.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser1.setCurrentDirectory(new File("."));
int result=chooser1.showOpenDialog(new JFrame());
File file=chooser1.getSelectedFile();
if(result==JFileChooser.APPROVE_OPTION);
{
t ry{
unzip("imagesdata.zip" ,file.toString());
}catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
结果:
2.4 幻灯片播放功能
class FileStartListener implements ActionListener{
public void actionPerformed(ActionEvent e){
JFrame f;
JPanel j;
JButton startBtn;
JButton stopBtn;
startBtn=new JButton("继续");
startBtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ee){
if(timer!=null)
timer.start();
}
});
stopBtn=new JButton("暂停");
stopBtn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ee){
if(timer!=null)
timer.stop();
}
});
f=new JFrame();
j=new JPanel();
f.setSize(800,700);
f.setLocation(300,50);
f.setVisible(true);
Container c=f.getContentPane();
c.add(new JScrollPane(jimageLabel));
j.add(startBtn);
j.add(stopBtn);
c.add(j,"South");
if(files2.length==0)
return;
timer=null;
timer=new Timer(200,new ActionListener(){
int index=0;
public void actionPerformed(ActionEvent el){
jimageLabel.setIcon(new ImageIcon(new
ImageIcon(files2[index].toString()).getImage().getScaledInstance(750,
600, Image.SCALE_SMOOTH)));
index++;
index%=files2.length;
}
});
timer.setCoalesce(true);
timer.setDelay(3*500);
timer.start();
}
}
结果:
五、调试与分析
1、首先遇到的问题是,如何在同一个面板上显示多张图片?
解决办法:将多个用于显示图片的JLabel控件,添加到JScollPanel控件中。
2、如何对图片进行分类?
解决办法:当鼠标点击某一图片时,记录该图片的物理地址,并保存到特定的文件中。
3、如何向压缩文件中添加新的压缩文件?
解决办法:先将原有的压缩文件解压到临时文件夹,然后将新文件与解压活的文件一起压缩。
六、功能测试
1、分类:
其它分类功能类同,不再一一显示;
2、备份:
3、幻灯片播放:
七、结论与心得
写这个程序时,遇到了很多问题,但是通过查阅资料以及网络搜索,大多都解决了;最后只剩一个问题没有解决,那就是如何想一个压缩文件中添加新的文件;我的方法是先将原有的压缩文件解压到临时文件夹,然后将新文件与解压活的文件一起压缩;但是这样程序会浪费很多系统资源,我感觉这种方法不是太好,但是又找不到更好的方法,希望老师帮我解答。
八、参考资料
【1】Java 开发实战1200例(第一卷)李钟尉陈丹丹清华大学出版社2011年1月
【2】Java项目开发案例全程实录(第二版)李钟尉陈丹丹清华大学出版社 2011年1月
【3】Java程序设计案例教程王成端清华大学出版社 2011年1月【4】[美]Bruce Eckel Prentice Hal PTR著、陈昊鹏等译 Thinking In Java(第3版)机械工业出版社 2005
附录(代码):
import javax.swing.*;
import javax.swing.Timer;
import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.tree.*;
import java.awt.event.*;
import java.awt.*;
import java.io.*;
import .URI;
import java.util.*;
import java.util.zip.*;
public class PictureDir extends JFrame{
String pt;
File[] files2;
JLabel[] imageLabel;
JLabel jlabel,jimageLabel;
JPanel jp1,jp2,jp3;
JButton[] jb;
private JTree tree;
private JScrollPane jsp1,jsp2,jsp3;
Timer timer;
public PictureDir(){
JMenuBar menuBar=new JMenuBar();
setJMenuBar(menuBar);
JMenu menu=new JMenu("文件");
menuBar.add(menu);
JMenuItem exitItem=new JMenuItem("退出");
menu.add(exitItem);
exitItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent
event){
System.exit(0);
}
});
JMenu menu1=new JMenu("分类");
menuBar.add(menu1);
JMenuItem c1=new JMenuItem("地点");
menu1.add(c1);
c1.addActionListener(new FileDidianListener());
JMenuItem c2=new JMenuItem("人物");
menu1.add(c2);
c2.addActionListener(new FileRenwuListener());
JMenuItem c3=new JMenuItem("相册");
menu1.add(c3);
c3.addActionListener(new FileXiangceListener());
JMenuItem c4=new JMenuItem("其它");
menu1.add(c4);
c4.addActionListener(new FileQitaListener());
JMenu menu2=new JMenu("数据库");
menuBar.add(menu2);
JMenuItem s1=new JMenuItem("备份");
menu2.add(s1);
s1.addActionListener(new FileZipListener());
JMenuItem s2=new JMenuItem("还原");
menu2.add(s2);
s2.addActionListener(new FileBackListener());
JMenu menu3=new JMenu("幻灯片播放");
menuBar.add(menu3);
JMenuItem h1=new JMenuItem("开始播放");
menu3.add(h1);
h1.addActionListener(new FileStartListener());
jp1=new JPanel();
jp2=new JPanel();
jp3=new JPanel();
jlabel=new JLabel("属性——类别");
jp3.add(jlabel);
imageLabel=new JLabel[50];
for(int i=0;i<imageLabel.length;i++){
imageLabel[i]=new JLabel();
jp2.add(imageLabel[i]);
}
jb=new JButton[4];
for(int i=0;i<4;i++){
jb[i]=new JButton();
jb[i].addActionListener(new JCAction());
jp3.add(jb[i]);
}
jb[0].setText("地点");
jb[1].setText("人物");
jb[2].setText("相册");
jb[3].setText("其它");
jimageLabel=new JLabel();
jimageLabel.setHorizontalAlignment (SwingConstants.CENTER);
tree=new JTree();
jsp1=new JScrollPane();
jsp2=new JScrollPane();
jsp1.setViewportView(tree);
jsp2.getViewport().add(jp2);
add(jsp1,"West");
add(jsp2,"Center");
add(jp1,"North");
add(jp3,"East");
jp2.setLayout(new GridLayout(10,5,20,20));
jp3.setLayout(new GridLayout(10,1,20,20));
rootNode=new DefaultMutableTreeNode("我的电脑");
addWindowListener(new WindowAction());
tree.addTreeSelectionListener(new TreeSelect());
setTitle("图片浏览器");
setSize(1210,610);
setLocation(100,50);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
class WindowAction implements WindowListener{
public void windowOpened(WindowEvent e){
File[] disks=File.listRoots();
for(File file:disks){
DefaultMutableTreeNode node=new
DefaultMutableTreeNode(file);
rootNode.add(node);
}
tree.setModel(new DefaultTreeModel
(rootNode));
tree.expandPath(new TreePath(rootNode));
}
public void windowActivated(WindowEvent e) {}
public void windowClosed(WindowEvent e) {}
public void windowClosing(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowIconified(WindowEvent e) {} }
class TreeSelect implements TreeSelectionListener{
public void valueChanged(TreeSelectionEvent e) {
TreePath path=e.getPath();
DefaultMutableTreeNode node=
(DefaultMutableTreeNode)path.getLastPathComponent();
Object userObject=node.getUserObject();
if(!(userObject instanceof File)){
return;
}
File folder=(File)userObject;
if(!folder.isDirectory())
return;
File[] files1=initImageSets1(folder);
for(File file:files1){
node.add(new
DefaultMutableTreeNode(file));
}
files2=initImageSets2(folder);
for(int i=0;i<imageLabel.length;i++){
imageLabel[i].setIcon(null);
imageLabel[i].setBorder(null);
}
for(int i=0;i<files2.length;i++){
imageLabel[i].setIcon(new
ImageIcon(files2[i].toString()));
imageLabel[i].addMouseListener(new
MouseAction());
imageLabel[i].setName
(String.valueOf(i));
resizeIcon(new ImageIcon(files2
[i].toString()),imageLabel[i]);
}
}
private File[] initImageSets1(File pictureDir){
return pictureDir.listFiles(new
FilenameFilter(){
public boolean accept(File
dir,String name){
if(!new File
(dir,name).isFile())
return true;
else
return false;
}
});
}
private File[] initImageSets2(File pictureDir){
return pictureDir.listFiles(new
FilenameFilter(){
public boolean accept(File
dir,String name){
if(!new File
(dir,name).isFile())
return false;
String
lowserName=name.toLowerCase();
if(lowserName.endsWith
("jpg")||lowserName.endsWith("jpeg")
||lowserName.endsWith("gif")||lowserName.endsWith("png")
||lowserName.endsWith("GIF")||lowserName.endsWith("TIFF")
||lowserName.endsWith("ICO")||lowserName.endsWith("BMP")){
return true;
}
return false;
}
});
}
}
class FileDidianListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
save(pt,"didian.txt");
JOptionPane.showMessageDialog
(null,"分类为“地点”完成!");
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
class FileRenwuListener implements ActionListener{ public void actionPerformed(ActionEvent e) {
try {
save(pt,"renwu.txt");
JOptionPane.showMessageDialog
(null,"分类为“人物”完成!");
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
private DefaultMutableTreeNode rootNode;
class FileXiangceListener implements ActionListener{ public void actionPerformed(ActionEvent e) {
try {
save(pt,"xiangce.txt");
JOptionPane.showMessageDialog
(null,"分类为“相册”完成!");
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
class FileQitaListener implements ActionListener{ public void actionPerformed(ActionEvent e) {
try {
save(pt,"qita.txt");
JOptionPane.showMessageDialog
(null,"分类为“其它”完成!");
} catch (Exception e1) {
e1.printStackTrace();
}
}
class FileZipListener implements ActionListener{ public void actionPerformed(ActionEvent e) {
try {
int a=0;
File file1=new File(pt);
File file2=new File
("imagesdata.zip");
File f=new File("D:/1/3/5");
f.mkdirs();
if(!file2.exists()){
file2.createNewFile();
a=1;
}
else
unzip
("imagesdata.zip","D:/1/3/5");
FileOutputStream fos= new
FileOutputStream(file2);
ZipOutputStream zos=new
ZipOutputStream(fos);
byte[] buffer=new byte[1024];
if(a==0){
File[] files=f.listFiles
();
File[] filess=new File
[files.length+1];
for(int
i=0;i<files.length;i++){
filess[i]=files
[i];
}
filess[filess.length-1]
=file1;
for (int i = 0; i <
filess.length; i++) {
String[]
st=filess[i].getName().split(".");
for(int
j=0;j<st.length;j++){
JOptionPane.showMessageDialog(null,j+"="+st[j]);
}
ZipEntry entry=new
ZipEntry(new Date().getTime()+filess[i].getName());
FileInputStream in = new
FileInputStream(filess[i]);
zos.putNextEntry(entry);
int len;
while ( (len = in.read
(buffer)) > 0) {
zos.write(buffer, 0,
len);
}
zos.closeEntry();
in.close();
}
}
if(a==1){
ZipEntry entry=new
ZipEntry(new Date().getTime()+file1.getName());
FileInputStream fis=new
FileInputStream(file1);
zos.putNextEntry(entry);
int read=0;
while((read=fis.read
(buffer))!=-1){
zos.write
(buffer,0,read);
}
zos.closeEntry();
fis.close();
}
zos.close();
fos.close();
JOptionPane.showMessageDialog
(null,"备份完成!");
deleteFile(f);
} catch (Exception e1) {
e1.printStackTrace();
JOptionPane.showMessageDialog
(null,"备份失败!");
File f=new File("D:/1/2/3");
deleteFile(f);
}
}
}
class FileBackListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
JFileChooser chooser1;
chooser1=new JFileChooser();
chooser1.setFileSelectionMode
(JFileChooser.DIRECTORIES_ONL Y);
chooser1.setCurrentDirectory(new File
("."));
int result=chooser1.showOpenDialog(new
JFrame());
File file=chooser1.getSelectedFile();
if(result==JFileChooser.APPROVE_OPTION);
{
try{
unzip("imagesdata.zip"
,file.toString());
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
class MouseAction implements MouseListener{ public void mouseClicked(MouseEvent e) {
for(int i=0;i<imageLabel.length;i++){
imageLabel[i].setBorder(null);
}
JLabel jl=(JLabel)e.getSource();
jl.setBorder(new MatteBorder
(5,5,5,5,Color.GREEN));
for(int i=0;i<100;i++){
if(i==Integer.parseInt(jl.getName
())){
pt=files2[i].toURI
().toString().replace("file:/", "").replace("%20", " ");
break;
}
}
}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {} }
class FileStartListener implements ActionListener{ public void actionPerformed(ActionEvent e){
JFrame f;
JPanel j;
JButton startBtn;
JButton stopBtn;
startBtn=new JButton("继续");
startBtn.addActionListener(new
ActionListener(){
public void actionPerformed (ActionEvent ee){
if(timer!=null)
timer.start();
}
});
stopBtn=new JButton("暂停");
stopBtn.addActionListener(new
ActionListener(){
public void actionPerformed
(ActionEvent ee){
if(timer!=null)
timer.stop();
}
});
f=new JFrame();
j=new JPanel();
f.setSize(800,700);
f.setLocation(300,50);
f.setVisible(true);
Container c=f.getContentPane();
c.add(new JScrollPane(jimageLabel));
j.add(startBtn);
j.add(stopBtn);
c.add(j,"South");
if(files2.length==0)
return;
timer=null;
timer=new Timer(200,new ActionListener(){
int index=0;
public void actionPerformed
(ActionEvent el){
jimageLabel.setIcon(new ImageIcon(new ImageIcon(files2[index].toString()).getImage
().getScaledInstance(750,
600,
Image.SCALE_SMOOTH)));
index++;
index%=files2.length;
}
});
timer.setCoalesce(true);
timer.setDelay(3*500);
timer.start();
}
}
class JCAction implements ActionListener{
public void actionPerformed(ActionEvent e){
Object source=e.getSource();
File[] files=new File[50];
String address=null;
for(int i=0;i<imageLabel.length;i++){
imageLabel[i].setIcon(null);
imageLabel[i].setBorder(null);
}
if(source==jb[0]){
address="didian.txt";
}
if(source==jb[1]){
address="renwu.txt";
}
if(source==jb[2]){
address="xiangce.txt";
}
if(source==jb[3]){
address="qita.txt";
}
try {
String[] path=read(address);
for(int i=0;i<path.length;i++){
files[i]=new File(path
[i]);
}
files2=files;
for(int i=0;i<path.length;i++){
imageLabel[i].setIcon(new
ImageIcon(files2[i].toString()));
imageLabel
[i].addMouseListener(new MouseAction());
imageLabel[i].setName
(String.valueOf(i));
resizeIcon(new ImageIcon
(files2[i].toString()),imageLabel[i]);
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
public String[] read(String address)throws Exception{ int i=0;
String[] path=new String[80];
BufferedReader reader=new BufferedReader(new
FileReader(new File(address)));
while((path[i++]=reader.readLine())!=null);
reader.close();
String[] p=new String[i-1];
for(int j=0;j<p.length;j++){
p[j]=path[j];
}
return p;
}
public void save(String path,String address)throws
Exception{
File file=new File(address);
path=path+"\r\n";
try{
if(!file.exists())
file.createNewFile();
FileOutputStream fos=new FileOutputStream
(file,true);
fos.write(path.getBytes());
fos.close();
}catch(IOException e){
e.printStackTrace();
}
}
public void unzip(String ars,String address) throws IOException{
ZipFile zf=new ZipFile(ars);
Enumeration ent=zf.entries();
while(ent.hasMoreElements()){
ZipEntry entry=(ZipEntry)ent.nextElement
();
InputStream in=zf.getInputStream(entry);
BufferedOutputStream out=new BufferedOutputStream(new FileOutputStream
(address+"/"+entry.getName()));
byte[] b=new byte[8*1024];
int len=0;
while((len=in.read(b))!=-1){
out.write(b,0,len);
}
in.close();
out.close();
}
}
public void resizeIcon(ImageIcon originalIcon,JLabel jlb){ ImageIcon icon=originalIcon;
icon=new ImageIcon(originalIcon.getImage
().getScaledInstance(150,
120, Image.SCALE_SMOOTH));
jlb.setIcon(icon);
}
public void deleteFile(File file){
if(file.exists()){
if(file.isFile()){
file.delete();
}else if(file.isDirectory()){
File files[] = file.listFiles();
for(int i=0;i<files.length;i++){
this.deleteFile(files[i]);
}
}
file.delete();
}
}
public static void main(String args[]) throws Exception{ PictureDir a=new PictureDir();
} }。