package dao;
import java.awt.Container;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import org.apache.log4j.Logger;
import common.Common;
public class ShowTime extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
Logger logger = Logger.getLogger(ShowTime.class);
Thread threadTimeType = null;
Thread threadMonkey = null;
JFrame frame = new JFrame("ExcuteCommand");
JPanel panel = new JPanel();
JFileChooser fileChooser = new JFileChooser();
JButton logPathButton = new JButton("选择路径");
JButton excuteButton = new JButton("运行命令");
JButton refreshButton = new JButton("刷新");
JButton resetButton = new JButton("重置页面");
JButton interruptButton = new JButton("终止运行");
JButton exitButton = new JButton("退出运行");
JLabel labelDevices = new JLabel("设备列表");
JLabel labelProgram = new JLabel("应用程序");
JLabel labelSpace = new JLabel("事件间隔");
JLabel labelMillisecond = new JLabel("毫秒");
JLabel labelTime = new JLabel("运行时长");
JLabel labelLogLevel = new JLabel("日志级别");
JLabel labelRestrain = new JLabel("约束条件");
JLabel labelHour = new JLabel();
JLabel labelMinute = new JLabel();
JLabel labelSecond = new JLabel();
JTextField textMillisecond = new JTextField(30);
JTextField textTime = new JTextField(30);
JTextField textLogPath = new JTextField(90);
JComboBox comboBoxDevices = new JComboBox();
JComboBox comboBoxProgram = new JComboBox();
JComboBox comboBoxTime = new JComboBox();
// --dbg-no-events:初始化启动的activity,但是不产生任何事件
JCheckBox checkBoxDbgNoEvents = new JCheckBox("初始化启动的activity,但是不产生任何事件");
// --hprof:指定该项后在事件序列发送前后会立即生成分析报告(一般建议指定该项)
JCheckBox checkBoxHprof = new JCheckBox("在事件序列发送前后会立即生成分析报告");
// --ignore-crashes:忽略崩溃
JCheckBox checkBoxCrashes = new JCheckBox("忽略崩溃", true);
// --ignore-timeouts:忽略超时
JCheckBox checkBoxTimeouts = new JCheckBox("忽略超时", true);
// --monitor-native-crashes:跟踪本地方法的崩溃问题
JCheckBox checkBoxNativeCrashes = new JCheckBox("跟踪本地方法的崩溃问题", true);
// --ignore-security-exceptions:忽略安全异常
JCheckBox checkBoxExceptions = new JCheckBox("忽略安全异常", true);
// --kill-process-after-error:发生错误后直接杀掉进程
JCheckBox checkBoxKill = new JCheckBox("发生错误后直接杀掉进程");
// --wait-dbg:知道连接了调试器才执行monkey测试
JCheckBox checkBoxWaitDbg = new JCheckBox("停止Monkey执行,直到有调试器与其连接");
ButtonGroup group = new ButtonGroup();
JRadioButton radioButton0 = new JRadioButton("基本信息");// 缺省值
JRadioButton radioButton1 = new JRadioButton("比较详细");// 比较详细
JRadioButton radioButton2 = new JRadioButton("非常详细", true);// 非常详细//默认选中
String dbgNoEvents = "";
String hprof = "";
String ignoreCrashes = "";
String ignoreTimeouts = "";
String monitorNativeCrashes = "";
String ignoreSecurityExceptions = "";
String killProcessAfterError = "";
String waitDbg = "";
String logLevel = "";
ArrayList<String> list;
ArrayList<String> arrayList = new ArrayList<String>();
int flag = 0;
// String logFolder = "";
String[] monkeyCmd = null;
public ShowTime() {
init();
logPathButton.addActionListener(this);
}
/**
* 初始化
*/
public void init() {
logger.info("页面初始化...");
// 设置面板位置
frame.add(panel, "Center");
// frame.setLayout(null);
// 设置大小
frame.setSize(Common.FrameWidth, Common.FrameHeigh);
// 禁止最大化
frame.setResizable(false);
// 设置位置
//初始化默认值
System.out.println(textMillisecond.getText());
int w = (Toolkit.getDefaultToolkit().getScreenSize().width - Common.FrameWidth) / 2;
int h = (Toolkit.getDefaultToolkit().getScreenSize().height - Common.FrameHeigh) / 2;
frame.setLocation(w, h);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.setVisible(true);
panel.setLayout(null);
panel.add(labelDevices);
panel.add(comboBoxDevices);
panel.add(refreshButton);
// refreshButton.setIcon(new
// ImageIcon(getClass().getResource("../pic/refresh2.jpg")));
panel.add(labelProgram);
panel.add(comboBoxProgram);
panel.add(labelRestrain);
panel.add(checkBoxCrashes);
panel.add(checkBoxTimeouts);
panel.add(checkBoxExceptions);
panel.add(checkBoxNativeCrashes);
panel.add(checkBoxKill);
panel.add(checkBoxWaitDbg);
panel.add(checkBoxHprof);
panel.add(labelSpace);
panel.add(labelHour);// 时
panel.add(labelMinute);// 分
panel.add(labelSecond);// 秒
panel.add(textMillisecond);
panel.add(labelMillisecond);
panel.add(labelTime);
panel.add(textTime);
panel.add(textLogPath);
panel.add(comboBoxTime);
panel.add(labelLogLevel);
panel.add(radioButton0);
panel.add(radioButton1);
panel.add(radioButton2);
panel.add(logPathButton);
panel.add(excuteButton);
panel.add(resetButton);
panel.add(interruptButton);
panel.add(exitButton);
labelDevices.setBounds(30, 25, 60, 20);
comboBoxDevices.setBounds(90, 25, 240, 20);
refreshButton.setBounds(340, 25, 60, 20);
// comboBoxDevices.setEditable(true);
labelProgram.setBounds(30, 55, 60, 20);
comboBoxProgram.setBounds(90, 55, 240, 20);
comboBoxProgram.setEditable(true);
comboBoxProgram.setSelectedItem("com.shinow.*");
labelRestrain.setBounds(30, 85, 56, 20);
checkBoxCrashes.setBounds(86, 85, 100, 20);
checkBoxTimeouts.setBounds(186, 85, 100, 20);
checkBoxExceptions.setBounds(286, 85, 110, 20);
checkBoxNativeCrashes.setBounds(400, 85, 180, 20);
checkBoxKill.setBounds(86, 115, 180, 20);
checkBoxWaitDbg.setBounds(286, 115, 280, 20);
checkBoxHprof.setBounds(86, 145, 280, 20);
labelSpace.setBounds(30, 175, 60, 20);
textMillisecond.setBounds(90, 175, 150, 20);
textMillisecond.setDocument(new NumberLenghtLimitedDmt(7));
textMillisecond.setText("500");
labelMillisecond.setBounds(245, 175, 40, 20);
labelTime.setBounds(30, 205, 60, 20);
textTime.setBounds(90, 205, 150, 20);
textTime.setDocument(new NumberLenghtLimitedDmt(7));
textTime.setText("1");
comboBoxTime.setBounds(245, 205, 50, 20);
comboBoxTime.addItem(Common.Hour);
comboBoxTime.addItem(Common.Minute);
comboBoxTime.addItem(Common.Second);
labelHour.setBounds(405, 205, 50, 20);
labelMinute.setBounds(475, 205, 50, 20);
labelSecond.setBounds(545, 205, 50, 20);
labelLogLevel.setBounds(30, 235, 60, 20);
group.add(radioButton0);
group.add(radioButton1);
group.add(radioButton2);
radioButton0.setBounds(86, 235, 80, 20);
radioButton1.setBounds(186, 235, 80, 20);
radioButton2.setBounds(286, 235, 80, 20);
logPathButton.setBounds(30, 265, 100, 20);
textLogPath.setBounds(140, 265, 320, 20);
textLogPath.setEditable(false);
textLogPath.setText("D:");
excuteButton.setBounds(30, 305, 100, 20);
resetButton.setBounds(140, 305, 100, 20);
interruptButton.setBounds(250, 305, 100, 20);
exitButton.setBounds(360, 305, 100, 20);
interruptButton.setEnabled(false);
logger.info("页面初始化完毕......");
}
/**
* 主方法,开始
*
* @param s
*/
public static void main(String s[]) {
new ShowTime().Show();
}
/**
* 运行
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
MonkeyUI.7z (50个子文件)
MonkeyUI源码
bin
dao
ShowTime$9.class 836B
ShowTime$2.class 1KB
CloseDoor$Dialog3$1.class 832B
ShowTime$1.class 861B
ShowTime$8.class 815B
CloseDoor$7.class 797B
ShowTime$3.class 5KB
CloseDoor$8.class 818B
ShowTime$5.class 936B
CloseDoor$Dialog1$1.class 924B
CloseDoor$Dialog1.class 2KB
CloseDoor.class 11KB
CloseDoor$2.class 1KB
ShowTime$Dialog2$1.class 824B
CloseDoor$9.class 810B
CloseDoor$3.class 4KB
ShowTime$Dialog1$1.class 993B
CloseDoor$5.class 860B
CloseDoor$4.class 1KB
CloseDoor$Dialog3.class 2KB
ShowTime$Dialog3$1.class 824B
CloseDoor$ThreadExcuteTime.class 2KB
ShowTime$6.class 832B
ShowTime$Dialog1.class 2KB
ShowTime$Dialog2.class 2KB
ShowTime$7.class 813B
CloseDoor$6.class 795B
CloseDoor$1.class 696B
AutoCompleter3.class 4KB
CloseDoor$Dialog2.class 2KB
ShowTime$ThreadExcuteMonkey.class 871B
CloseDoor$ThreadExcuteMonkey.class 877B
CloseDoor$Dialog2$1.class 832B
ShowTime.class 13KB
NumberLenghtLimitedDmt.class 1KB
ShowTime$10.class 830B
ShowTime$Dialog3.class 2KB
ShowTime$4.class 1KB
ShowTime$ThreadExcuteTime.class 5KB
log4j.properties 696B
common
Common.class 3KB
src
dao
CloseDoor.java 27KB
ShowTime.java 27KB
NumberLenghtLimitedDmt.java 824B
log4j.properties 696B
common
Common.java 3KB
.project 384B
.classpath 291B
lib
log4j-1.2.17.jar 478KB
MonkeyUI.jar 491KB
共 50 条
- 1
资源评论
- Aloys_Code2018-08-24还不错的源码
- baidu_377720772018-09-27什么东西呀
wang812745312
- 粉丝: 36
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功