用JAVA实现了带有复选框的树目录
JDK版本
JDK1.4.x
功能
实现了带有复选框的资源管理器树目录,还有需要改进的地方,我在以后更新,如果那位朋友有好的建议欢迎提出
欢迎大家提意见,交流
代码如下
import javax.swing.tree.*;
import javax.swing.filechooser.*;
import javax.swing.event.*;
import java.awt.Cursor;
import java.awt.Component;
import java.awt.Font;
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
/**
* Title: 系统级树目录
* Description:
* Copyright: Copyright (c) 2004
* Company:
* @author cuijiang contact cj0063@sina.com or cuij7718@yahoo.com.cn
* @version 1.0
*/
public class AgileSuperJTreeBasic
extends JTree
implements TreeExpansionListener, TreeSelectionListener, MouseListener {
protected DefaultTreeModel treeModel;
protected FileSystemView fileSystemView; //建立文件系统视类对象
protected FileNode root;
public AgileSuperJTreeBasic() {
Font myFont = new Font("宋体", 11, 12);
fileSystemView = FileSystemView.getFileSystemView();
root = new FileNode(fileSystemView.getRoots()[0]);
root.explore();
treeModel = new DefaultTreeModel(root);
this.setModel(treeModel); //设定树形菜单
this.addTreeExpansionListener(this); //打开/关闭节点事件
this.addTreeSelectionListener(this); //选择的事件
this.setCellRenderer(new MyTreeCellRenderer()); //生成图标
this.setFont(myFont);
this.setRootVisible(true);
this.setRowHeight(18);
相关文档:
1。使用java.util.Properties类的load()方法
示例: InputStream in = lnew BufferedInputStream(new FileInputStream(name));
Properties p = new Properties();
p.load(in);
2。使用java.util.ResourceBundle类的getBundle()方法
示例: ResourceBundle rb = ResourceBundle.getBundle(name, Locale.getDefault());
......
【文章标题】java小程序(3)
【文章作者】曾健生
【作者邮箱】zengjiansheng1@126.com
【作者QQ】190678908
【作者声明】本人水平有限,失误之处,敬请各位指出。本人以前写的一些小程序,分享一下希望对各位学习java有帮助 ^-^
***************************************************************************** ......
真正发现人生需要知识的时候,我的青春已经浪费了一半。
于是鼓起勇气来到北大青鸟学习IT,鉴于多方考虑,还是选择了软件测试。
如今课业的一大半也已结束,从刚开始的一无所知,渐渐成长为一个菜鸟……
在课程的学习过程中,才渐渐发现自己对于这个行业的兴趣,尤其是软件开发这一块。
甚至对自己选择做测 ......
一、.net Server端
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Web.Services.Description;
namespace WebApplica ......
Java语言反射提供一种动态链接程序组件的多功能方法。它允许程序创建和控制任何类的对象(根据安全性限制),无需提前硬编码目标类。这些特性使得反射特别适用于创建以非常普通的方式与对象协作的库。例如,反射经常在持续存储对象为数据库、XML或其它外部格式的框架中使用。Java reflection 非常 ......