⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eventframe.java

📁 网络代理服务器的设计与实现 实现对网络的管理
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import java.lang.reflect.*;
import java.util.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;

public class eventFrame extends JFrame implements TreeSelectionListener
{
	  public static JSplitPane jSplitPane1;	  
	  public static welcomePanel welcomePanel1;
	  public static toolBarPanel toolBar;
	  public static statusBarPanel statusBar;
	  public static disPlayPane  disPlay;
	  public static filterPane1 filterPanel1;
	  public static filterPane2 filterPanel2;
	  public static filterPane3 filterPanel3;
	  public static cachePane cachePanel;
	  public static timePane timePanel;
	  public static portPane portPanel;
	  public static erJiPane erjiPanel;
	  public static fluxStatPane fluxStatPanel;
	  public static userPane userPanel;
	  //添加页面
	  
	  
	  private JTree jTree1;	  
	  private String CardID;
	  
  public eventFrame(String ID) {
    try {
      CardID = ID;
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }

  private void jbInit() throws Exception {
    
	this.setTitle("HTTP ProxyServer");
	this.getContentPane().setLayout(new BorderLayout());
	
	toolBar=new toolBarPanel();
	this.getContentPane().add(toolBar,BorderLayout.NORTH);
	
	
    jSplitPane1 = new JSplitPane();    
    jSplitPane1.setBounds(new Rectangle(0, 0, 600, 450));
    this.getContentPane().add(jSplitPane1, BorderLayout.CENTER);
    
    statusBar=new statusBarPanel();
    this.getContentPane().add(statusBar,BorderLayout.SOUTH);
    
    welcomePanel1 = new welcomePanel();
    disPlay=new disPlayPane();
    filterPanel1=new filterPane1();
    filterPanel2=new filterPane2();
    filterPanel3=new filterPane3();
    cachePanel=new cachePane();
    timePanel=new timePane();
    portPanel=new portPane();
    erjiPanel=new erJiPane();
    fluxStatPanel=new fluxStatPane();
    userPanel=new userPane();

    DefaultMutableTreeNode root = new DefaultMutableTreeNode("代理服务器系统");    
    DefaultMutableTreeNode bitchThing = new DefaultMutableTreeNode("用户列表");
    root.add(bitchThing);
    bitchThing = new DefaultMutableTreeNode("设置");
    bitchThing.add(new DefaultMutableTreeNode("网页缓存"));
    bitchThing.add(new DefaultMutableTreeNode("端口/日志"));
    bitchThing.add(new DefaultMutableTreeNode("二级代理"));
    root.add(bitchThing);
    bitchThing = new DefaultMutableTreeNode("管理");
    DefaultMutableTreeNode bitchThing2 = new DefaultMutableTreeNode("禁止站点");
    bitchThing2.add(new DefaultMutableTreeNode("一般用户"));
    bitchThing2.add(new DefaultMutableTreeNode("特级用户"));
    bitchThing2.add(new DefaultMutableTreeNode("超级用户"));
    bitchThing.add(bitchThing2);
    bitchThing.add(new DefaultMutableTreeNode("时间安排"));
    bitchThing.add(new DefaultMutableTreeNode("流量统计"));
    root.add(bitchThing);
    bitchThing = new DefaultMutableTreeNode("帮助");
    bitchThing.add(new DefaultMutableTreeNode("产品介绍"));
    bitchThing.add(new DefaultMutableTreeNode("联系我们"));
    root.add(bitchThing);
    jTree1 = new JTree(root);

    jSplitPane1.setDividerLocation(100);
    jSplitPane1.add(jTree1, JSplitPane.LEFT);
    jSplitPane1.add(welcomePanel1,JSplitPane.RIGHT);

    jTree1.addTreeSelectionListener(this);
    int mode = TreeSelectionModel.SINGLE_TREE_SELECTION;
    jTree1.getSelectionModel().setSelectionMode(mode);
  }

  public void valueChanged(TreeSelectionEvent event){
    String node=jTree1.getLastSelectedPathComponent().toString();
    if(node.equals("用户列表")){
        jSplitPane1.remove(jSplitPane1.getRightComponent());
        jSplitPane1.add(userPanel,JSplitPane.RIGHT);
    }
    if(node.equals("网页缓存")){
      jSplitPane1.remove(jSplitPane1.getRightComponent());
      jSplitPane1.add(cachePanel,JSplitPane.RIGHT);
    }
    if(node.equals("二级代理")){
        jSplitPane1.remove(jSplitPane1.getRightComponent());
        jSplitPane1.add(erjiPanel,JSplitPane.RIGHT);
      }
    if(node.equals("端口/日志")){
        jSplitPane1.remove(jSplitPane1.getRightComponent());
        jSplitPane1.add(portPanel,JSplitPane.RIGHT);
      }
    if(node.equals("一般用户")){
        jSplitPane1.remove(jSplitPane1.getRightComponent());
        jSplitPane1.add(filterPanel3,JSplitPane.RIGHT);
      }
    if(node.equals("特级用户")){
        jSplitPane1.remove(jSplitPane1.getRightComponent());
        jSplitPane1.add(filterPanel2,JSplitPane.RIGHT);
      }
    if(node.equals("超级用户")){
        jSplitPane1.remove(jSplitPane1.getRightComponent());
        jSplitPane1.add(filterPanel1,JSplitPane.RIGHT);
      }
    if(node.equals("时间安排")){
        jSplitPane1.remove(jSplitPane1.getRightComponent());
        jSplitPane1.add(timePanel,JSplitPane.RIGHT);
      }
    if(node.equals("流量统计")){
        jSplitPane1.remove(jSplitPane1.getRightComponent());
        jSplitPane1.add(fluxStatPanel,JSplitPane.RIGHT);
    }
    if(node.equals("产品介绍")){
      //jSplitPane1.remove(jSplitPane1.getRightComponent());
      //jSplitPane1.add(getPanel1,JSplitPane.RIGHT);
    }
    if(node.equals("联系我们")){
        //jSplitPane1.remove(jSplitPane1.getRightComponent());
        //jSplitPane1.add(getPanel1,JSplitPane.RIGHT);
      }
    if(node.equals("代理服务器系统")||node.equals("设置")||node.equals("管理")||node.equals("帮助")||node.equals("禁止站点")){
    	jSplitPane1.remove(jSplitPane1.getRightComponent());
    	if(toolBarPanel.state()){
    		eventFrame.jSplitPane1.add(eventFrame.welcomePanel1,JSplitPane.RIGHT);
    	}else{
    		eventFrame.jSplitPane1.add(eventFrame.disPlay,JSplitPane.RIGHT);
    	}
    }
  }  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -