77范文网 - 专业文章范例文档资料分享平台

功能较完善的文件管理器java课程设计报告毕业设计(论文)(2)

来源:网络收集 时间:2018-11-30 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

popupMenu_Delete = new JMenuItem(\删除(D)\, 'D'); p_zip =new JMenuItem(\添加到压缩文件\);

// ---------------向右键菜单添加菜单项和分隔符 popupMenu.addSeparator(); popupMenu.add(newfiles);

popupMenu.add(popupMenu_Copy); popupMenu.add(p_zip);

popupMenu.add(popupMenu_Delete); popupMenu.addSeparator();

// --------------------右键菜单注册事件 popupMenu_Copy.setActionCommand(\复制(C)\); popupMenu_Copy.addActionListener(this);

popupMenu_Delete.setActionCommand(\删除(D)\); popupMenu_Delete.addActionListener(this); newfiles.setActionCommand(\新建文件夹\); newfiles.addActionListener(this); p_zip.addActionListener(this); jtree.add(popupMenu);

///////////////////////////////////////////////////////////// menu = new PopupMenu();

newfload=new MenuItem(\新建文件夹\); newfile=new MenuItem(\新建文件\); b_open=new MenuItem(\打开\); b_copy=new MenuItem(\复制\);

b_Zip=new MenuItem(\添加到压缩文件\); b_del=new MenuItem(\删除\);

b_rename=new MenuItem(\重命名\); menu.addSeparator(); menu.add(b_open); menu.add(newfload); menu.add(newfile); menu.add(b_copy); menu.add(b_Zip); menu.add(b_rename); menu.add(b_del); menu.addSeparator();

b_open.addActionListener(this); newfload.addActionListener(this); b_copy.addActionListener(this); b_del.addActionListener(this); b_Zip.addActionListener(this);

b_rename.addActionListener(this); newfile.addActionListener(this); JPsub.add(menu);

////////////////////////////////////////////////////////////// //水平分割窗口,左scrollPane内放tree,右放JPsub用于显示文件 JSP=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(jtree),new JScrollPane(JPsub));

JSP.setDividerLocation (200);////////设置分隔条的位置。

JSP.setLastDividerLocation(200); /////// 将分隔条所处的最后位置设置为 newLastLocation。

getContentPane().add(JSP);

//背景色为白

JPsub.setBackground(Color.white); //////////////////////////////////////

/////////////////////////////////////////////时间///////////////////////

statusBar = new JToolBar();

shijian = new JLabel(\当前时间:\ + hour + \ + min + \ + second);

statusBar.addSeparator(); statusBar.add(shijian);

statusBar.setVisible(true);

container.add(statusBar, BorderLayout.SOUTH); statusBar.setVisible(true);

////////////////////////////////////////////// //给树添加展开监听器

jtree.addTreeExpansionListener(this); jtree.addTreeSelectionListener(this);

//设置树的外形 ,改变文件夹的图案 try {

UIManager.setLookAndFeel(\AndFeel\);

SwingUtilities.updateComponentTreeUI(this); }

catch (Exception ex) {}

jtree.setShowsRootHandles(true);

getContentPane().add(road,BorderLayout.NORTH); road.add(status,BorderLayout.WEST); ///西边....左边 Clock clock=new Clock();////线程 clock.start();

////////////////////////////////////////////////// f = new JFrame(\重命名\) ;

f.setSize(230,80) ; // 设置组件的大小

f.setBackground(Color.WHITE) ; // 将背景设置成白色 f.setLocation(300,200) ; // 设置组件的显示位置 renamest=new JTextField(); sure=new JButton(\确定\);

f.add(renamest,BorderLayout.CENTER); f.add(sure,BorderLayout.SOUTH); sure.addActionListener(this);

////////////////////////////////////////////////// ff = new JFrame(\压缩文件名\) ;

ff.setSize(230,80) ; // 设置组件的大小 ff.setBackground(Color.WHITE) ; // 将背景设置成白色 ff.setLocation(300,200) ; // 设置组件的显示位置 zipname=new JTextField(); ok=new JButton(\确定\);

ff.add(zipname,BorderLayout.CENTER); ff.add(ok,BorderLayout.SOUTH); ok.addActionListener(this); }

////////////实现复制,黏贴功能//////////////////////////// class MainFrame extends JFrame { /** * */

private static final long serialVersionUID = 1L;

public MainFrame() {

super(\);

setDefaultCloseOperation(HIDE_ON_CLOSE); setSize(500,260);

setLocation(300,200) ;

MainPanel pan = new MainPanel(); setContentPane(pan); setLayout(null); }

}

class MainPanel extends JPanel {

/** * */

private static final long serialVersionUID = 1L; JTextField txt;

JTextArea txtInFile; JTextArea txtOutFile; JFileChooser open; String strFilePath;

String strFilePathCopyTo; public MainPanel() {

JLabel lblIn = new JLabel(\源文件:\); lblIn.setBounds(30, 65, 50, 20); if(F_list.isSelectionEmpty())

txtInFile = new JTextArea(zhantie()); else

txtInFile = new JTextArea(zhantie()+F_list.getSelectedValue()); JScrollPane scrint = new JScrollPane(txtInFile) ; scrint.setBounds(80,65,265,40);

JButton btnSelect = new JButton(\选择文件或目录\); btnSelect.setBounds(350, 65, 120, 20);

open = new JFileChooser();/////////////////////

txtInFile = new JTextArea(zhantie()+F_list.getSelectedValue()); open.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); open.setCurrentDirectory(new File(zhantie())); btnSelect.addActionListener(new ActionListener() {

@SuppressWarnings(\)

public void actionPerformed(ActionEvent e) {

open.showOpenDialog(null);

strFilePath = open.getSelectedFile().getPath();///源文件路径 ((JButton)e.getSource()).setLabel(\已选\); txtInFile.setText(strFilePath);

System.out.println(txtInFile.getText());

System.out.println(\打开文件\); } } );

JLabel lblOut = new JLabel(\复制到:\); lblOut.setBounds(30, 125, 50, 20); txtOutFile = new JTextArea();

txtOutFile.setBounds(80,60,100,20);

JScrollPane scrout = new JScrollPane(txtOutFile) ; scrout.setBounds(80,125,265,40);

JButton btnSelectCopyTo = new JButton(\选择目标路径\); btnSelectCopyTo.setBounds(350, 125, 120, 20);

btnSelectCopyTo.addActionListener(new ActionListener() {

@SuppressWarnings(\)

public void actionPerformed(ActionEvent e) {

if(F_list.isSelectionEmpty())

open.setSelectedFile(new File(zhantie())); else

open.setSelectedFile(new

File(zhantie()+F_list.getSelectedValue())); open.showSaveDialog(null);

strFilePathCopyTo = open.getSelectedFile().getPath(); ((JButton)e.getSource()).setLabel(\已选\); txtOutFile.setText(strFilePathCopyTo);

System.out.println(txtOutFile.getText());

System.out.println(\打开文件\); } } );

JButton btnCopy = new JButton(\开始复制\); btnCopy.setBounds(130, 180, 90, 20);

btnCopy.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库功能较完善的文件管理器java课程设计报告毕业设计(论文)(2)在线全文阅读。

功能较完善的文件管理器java课程设计报告毕业设计(论文)(2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/324120.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: