Exemplo n.º 1
0
 private void updateProjectPath() {
   if (myProjectPath.getPath() == null
       || myProjectPath.getPath().length() == 0
       || myProjectPath.getPath().startsWith(PROJECTS_DIR)) {
     myProjectPath.setPath(PROJECTS_DIR + File.separator + myProjectName.getText());
   }
 }
  public TrafficModeling() {
    this.setLayout(null);

    // 第一栏,流量文件/路径选择
    JLabel lbl1 = new JLabel("流量文件/路径");
    lbl1.setBounds(220, 50, 160, 30);
    this.add(lbl1);
    pathTraffic = new PathField(true, true, new ExtensionFileFilter("pcap流量文件", "pcap"));
    pathTraffic.setPath(Setting.getWorkspacePath() + "traffics");
    pathTraffic.setBounds(400, 50, 450, 30);
    this.add(pathTraffic);

    // 第二栏,输出路径选择
    JLabel lbl2 = new JLabel("模型输出路径");
    lbl2.setBounds(220, 100, 160, 30);
    this.add(lbl2);
    pathOutput = new PathField(false, true, null);
    pathOutput.setPath(Setting.getWorkspacePath() + "models");
    pathOutput.setBounds(400, 100, 450, 30);
    this.add(pathOutput);

    // 第三栏,建模级别
    JLabel lbl3 = new JLabel("建模级别");
    lbl3.setBounds(220, 150, 100, 30);
    this.add(lbl3);
    this.add(getSessionbutton());
    this.add(getPacketbutton());
    bindButtonGroup();

    // 第四栏,建模精度1
    lblPrecisionSize = new JLabel("Packet长度建模精度");
    lblPrecisionSize.setBounds(220, 200, 150, 30);
    this.add(lblPrecisionSize);

    txtPrecisionSize = new JTextField("10");
    txtPrecisionSize.setBounds(400, 200, 100, 30);
    this.add(txtPrecisionSize);

    lblPrecisionSizeTip = new JLabel("Bytes");
    lblPrecisionSizeTip.setBounds(510, 200, 400, 30);
    this.add(lblPrecisionSizeTip);

    // 第五栏,建模精度2
    lblPrecisionTime = new JLabel("Packet时间间隔建模精度");
    lblPrecisionTime.setBounds(220, 250, 200, 30);
    this.add(lblPrecisionTime);

    txtPrecisionTime = new JTextField("50");
    txtPrecisionTime.setBounds(400, 250, 100, 30);
    this.add(txtPrecisionTime);

    lblPrecisionTimeTip = new JLabel("各数量级上的划分数(1~100值越大精度越高)");
    lblPrecisionTimeTip.setBounds(510, 250, 400, 30);
    this.add(lblPrecisionTimeTip);

    // 开始建模按钮
    this.add(getStartButton());

    // 结果展示部分
    JScrollPane scrollPane = new JScrollPane(getResultsPanel());
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    //		for (int i=0;i<20;++i)
    //			addResult("C:/123.pcap", "C:/466.model", "C:/46.tmp");

    scrollPane.setBounds(0, 300, 1280 - 100, 500 - 80);
    this.add(scrollPane);
  }