易截截图软件、单文件、免安装、纯绿色、仅160KB

用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);
 


相关文档:

java小程序(1)

【文章标题】java小程序(1)
【文章作者】曾健生
【作者邮箱】zengjiansheng1@126.com
【作者QQ】190678908
【作者声明】本人水平有限,失误之处,敬请各位指出。本人以前写的一些小程序,分享一下希望对各位学习java有帮助 ^-^
***************************************************************************** ......

java小程序(3)

【文章标题】java小程序(3)
【文章作者】曾健生
【作者邮箱】zengjiansheng1@126.com
【作者QQ】190678908
【作者声明】本人水平有限,失误之处,敬请各位指出。本人以前写的一些小程序,分享一下希望对各位学习java有帮助 ^-^
***************************************************************************** ......

java io正确读取

写入
 public static void Writer(String value) {
         try{
          File file2 = new File("F:\\countDB.txt");
          if(!file2.exists()){
       ......

Java 常见设计模式

常用的设计模式分为如下 23 种模式:
Abstract Factory:
提供一个创建一系列相关或相互依赖对象的接口,而无需指定它们具体的类。
Adapter:
将一个类的接口转换成客户希望的另一个接口,使得原来由于接口不兼容而不能一起工作的那些类可以一起工作。
Bridge:
将抽象部分与它的实现部分分离,使之可以独立变化。
C ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号