/*
* Copyright (C) 2004 Sun Microsystems, Inc. All rights reserved. Use is
* subject to license terms.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the Lesser GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.tree.*;
import javax.swing.table.TableColumn;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
import java.io.IOException;
import java.io.File;
import org.jdesktop.jdic.desktop.*;
/**
* JDIC API demo main class.
* <p>
* The main class for the demo. Class <code>FileExplorer</code> creates a UI
* interface demonstrating the usage of the public API of <code>org.jdesktop.jdic.desktop.*
* </code> classes.
*/
public class FileExplorer extends JPanel {
public static ImageIcon computerIcon;
public static ImageIcon driverIcon;
public static ImageIcon folderIcon;
public static ImageIcon fileIcon;
public static ImageIcon browseIcon;
public static String MY_COMPUTER_FOLDER_PATH = System.getProperty("java.io.tmpdir")
+ File.separator + "My Computer";
// Currently selected tree node in the left disk tree.
public static MyTreeNode selectedTreeNode = null;
// Currently selected file in the right table.
File selectedFile = null;
BorderLayout borderLayout1 = new BorderLayout();
JPopupMenu jDesktopPopupMenu = new JPopupMenu();
JMenuItem jMenuItemOpen = new JMenuItem();
JMenuItem jMenuItemEdit = new JMenuItem();
JMenuItem jMenuItemPrint = new JMenuItem();
JMenuItem jMenuItemBrowse = new JMenuItem();
JMenuItem jMenuItemMail = new JMenuItem();
JSplitPane jSplitPane = new JSplitPane();
JTree jTreeDisk = new JTree(createTreeModel());
JScrollPane tableScrollPane = new JScrollPane();
MyTableModel tableModel = new MyTableModel();
MyTable jTable = new MyTable();
JPanel jAddressPanel = new JPanel();
JLabel jAddressLabel = new JLabel();
JTextField jAddressTextField = new JTextField();
JButton jBrowseButton = new JButton();
MyStatusBar statusBar = new MyStatusBar();
public FileExplorer() {
try {
System.setSecurityManager(null);
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {}
JFrame frame = new JFrame("JDIC API Demo - FileExplorer");
Container contentPane = frame.getContentPane();
contentPane.setLayout(new GridLayout(1, 1));
contentPane.add(new FileExplorer());
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.pack();
frame.setVisible(true);
}
private void jbInit() throws Exception {
try {
computerIcon = new ImageIcon(FileExplorer.class.getResource("images/Computer.gif"));
driverIcon = new ImageIcon(FileExplorer.class.getResource("images/Driver.gif"));
folderIcon = new ImageIcon(FileExplorer.class.getResource("images/Folder.gif"));
fileIcon = new ImageIcon(FileExplorer.class.getResource("images/File.gif"));
browseIcon = new ImageIcon(FileExplorer.class.getResource("images/Right.gif"));
} catch (Exception e) {
System.out.println("ERROR loading image files !");
}
this.setLayout(borderLayout1);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setPreferredSize(new Dimension(screenSize.width * 4 / 5,
screenSize.height * 7 / 10));
jMenuItemOpen.setText("Open");
jMenuItemOpen.addActionListener(new
FileExplorer_jMenuItemOpen_actionAdapter(this));
jMenuItemEdit.setText("Edit");
jMenuItemEdit.addActionListener(new
FileExplorer_jMenuItemEdit_actionAdapter(this));
jMenuItemPrint.setText("Print");
jMenuItemPrint.addActionListener(new
FileExplorer_jMenuItemPrint_actionAdapter(this));
jMenuItemBrowse.setText("Browse");
jMenuItemBrowse.addActionListener(new
FileExplorer_jMenuItemBrowse_actionAdapter(this));
jMenuItemMail.setText("Mail to ...");
jMenuItemMail.addActionListener(new
FileExplorer_jMenuItemMail_actionAdapter(this));
jTreeDisk.addTreeExpansionListener(new
FileExplorer_jTreeDisk_treeExpansionAdapter(this));
jAddressLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
jAddressLabel.setToolTipText("");
jAddressLabel.setText("Address");
jBrowseButton.setBorder(BorderFactory.createCompoundBorder(new EmptyBorder(0,
2, 0, 2),
new EtchedBorder()));
jBrowseButton.setToolTipText("Browse the given URL with system default browser");
jBrowseButton.setIcon(browseIcon);
jBrowseButton.setText("Browse ");
jBrowseButton.addActionListener(new
FileExplorer_jBrowseButton_actionAdapter(this));
jAddressPanel.setLayout(new BorderLayout());
jAddressTextField.addActionListener(new
FileExplorer_jAddressTextField_actionAdapter(this));
jAddressPanel.add(jAddressLabel, BorderLayout.WEST);
jAddressPanel.add(jAddressTextField, BorderLayout.CENTER);
jAddressPanel.add(jBrowseButton, BorderLayout.EAST);
jAddressPanel.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
jTreeDisk.addMouseListener(new FileExplorer_jTreeDisk_mouseAdapter(this));
jTreeDisk.addTreeWillExpandListener(new
FileExplorer_jTreeDisk_treeWillExpandAdapter(this));
jTreeDisk.setCellRenderer(new MyTreeRenderer());
jTreeDisk.getSelectionModel().setSelectionMode
(TreeSelectionModel.SINGLE_TREE_SELECTION);
jTreeDisk.setSelectionRow(0);
jTreeDisk.setBackground(Color.white);
jTreeDisk.setAlignmentX((float) 0.5);
jTreeDisk.setShowsRootHandles(false);
jTreeDisk.addTreeSelectionListener(new
FileExplorer_jTreeDisk_treeSelectionAdapter(this));
jTable.setBorder(null);
jTable.setModel(tableModel);
TableColumn column = jTable.getColumnModel().getColumn(0);
column.setCellRenderer(new MyTableRenderer());
column = jTable.getColumnModel().getColumn(1);
column.setCellRenderer(new MyTableRenderer());
jTable.setShowHorizontalLines(false);
jTable.setShowVerticalLines(false);
jTable.addMouseListener(new FileExplorer_jTable_mouseAdapter(this));
tableScrollPane.setViewportView(jTable);
jSplitPane.setBorder(null);
jSplitPane.add(new JScrollPane(jTreeDisk), JSplitPane.LEFT);
jSplitPane.add(tableScrollPane, JSplitPane.RIGHT);
statusBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
statusBar.lblDesc.setText("JDIC API Demo - FileExplorer");
this.add(jAddressPanel, BorderLayout
没有合适的资源?快使用搜索试试~ 我知道了~
jdic-0.9.1-bin-cross-platform.zip
共180个文件
html:62个
class:59个
java:14个
需积分: 9 14 下载量 46 浏览量
2008-11-16
12:24:36
上传
评论
收藏 1.16MB ZIP 举报
温馨提示
jdic-0.9.1-bin-cross-platform.zip
资源推荐
资源详情
资源评论
收起资源包目录
jdic-0.9.1-bin-cross-platform.zip (180个子文件)
mozembed-solaris-gtk1.2 31KB
mozembed-linux-gtk1.2 9KB
mozembed-solaris-gtk1.2 6KB
ChangeLog 9KB
FileExplorer.class 16KB
FileTypes.class 11KB
Browser.class 7KB
Tray.class 7KB
FileChooser.class 6KB
SimpleBrowser.class 3KB
MyTableModel.class 3KB
MyTreeNode.class 2KB
MyUtility.class 2KB
Browser$2.class 1KB
Tray$3.class 1KB
MyStatusBar.class 1022B
MyStatusBar.class 911B
MyTableRenderer.class 889B
MyTreeRenderer.class 810B
SimpleBrowser$1.class 621B
DiskObject.class 547B
FileExplorer_jTreeDisk_treeWillExpandAdapter.class 539B
Tray$2.class 531B
Tray$1.class 503B
FileExplorer_jTable_mouseAdapter.class 496B
MyTable.class 483B
FileExplorer_jTreeDisk_treeExpansionAdapter.class 465B
FileTypes_jRadioButtonUnregisterUser_actionAdapter.class 423B
FileExplorer_jTreeDisk_treeSelectionAdapter.class 422B
FileTypes_jRadioButtonUnregisterSys_actionAdapter.class 421B
FileTypes_jRadioButtonRegisterUser_actionAdapter.class 419B
FileTypes_jRadioButtonRegisterSys_actionAdapter.class 417B
FileExplorer_jAddressTextField_actionAdapter.class 417B
FileChooser_jFileChooser_propertyChangeAdapter.class 417B
FileExplorer_jMenuItemBrowse_actionAdapter.class 413B
FileChooser_jCreateMailButton_actionAdapter.class 413B
FileExplorer_jMenuItemPrint_actionAdapter.class 411B
FileTypes_jAddNewActionButton_actionAdapter.class 409B
FileExplorer_jMenuItemOpen_actionAdapter.class 409B
FileExplorer_jMenuItemMail_actionAdapter.class 409B
FileExplorer_jBrowseButton_actionAdapter.class 409B
FileExplorer_jMenuItemEdit_actionAdapter.class 409B
FileTypes_jRadioButtonGetMime_itemAdapter.class 405B
FileChooser_jUrlTextField_actionAdapter.class 405B
FileChooser_jBrowseButton_actionAdapter.class 405B
FileTypes_jRadioButtonGetExt_itemAdapter.class 403B
FileChooser_jPrintButton_actionAdapter.class 403B
FileChooser_jEditButton_actionAdapter.class 401B
FileChooser_jOpenButton_actionAdapter.class 401B
Browser_jAddressTextField_actionAdapter.class 397B
FileTypes_jCancelButton_actionAdapter.class 397B
FileTypes_jApplyButton_actionAdapter.class 395B
Browser_jForwardButton_actionAdapter.class 391B
Browser_jRefreshButton_actionAdapter.class 391B
Browser_jStopButton_actionAdapter.class 385B
Browser_jBackButton_actionAdapter.class 385B
Browser_jGoButton_actionAdapter.class 381B
MyUtility$FileSystemRoot.class 373B
FileExplorer_jTreeDisk_mouseAdapter.class 367B
FileExplorer$1.class 302B
FileChooser$1.class 301B
FileTypes$1.class 299B
Browser$1.class 297B
COPYING 26KB
stylesheet.css 1KB
jdic.dll 120KB
tray.dll 56KB
MozEmbed.exe 184KB
IeEmbed.exe 52KB
duke.gif 5KB
Computer.gif 990B
Folder.gif 904B
File.gif 897B
Driver.gif 879B
middle.gif 235B
Right.gif 82B
Right.gif 82B
inherit.gif 57B
index-all.html 63KB
WebBrowser.html 41KB
Association.html 28KB
AssociationService.html 26KB
TrayIcon.html 25KB
WebBrowserEvent.html 21KB
Action.html 18KB
Message.html 18KB
Desktop.html 18KB
WebBrowserListener.html 16KB
Association.html 13KB
AssociationAlreadyRegisteredException.html 13KB
AssociationNotRegisteredException.html 13KB
AssociationException.html 12KB
WebBrowser.Status.html 12KB
WebBrowserUtil.html 12KB
WebBrowserEvent.html 12KB
RegisterFailedException.html 12KB
serialized-form.html 12KB
DesktopException.html 11KB
SystemTray.html 11KB
constant-values.html 11KB
共 180 条
- 1
- 2
资源评论
SKYMSDN
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功