📄 form1.java
字号:
str=str+blackTester.outData.elementAt (intGroup*tester.outputLines+i)+"\r\n";
// str=str+" 与标准答案一致:"+blackTester.cmpResult.elementAt (intGroup*tester.outputLines+i)+"\r\n";
if (blackTester.cmpResult.elementAt (intGroup*tester.outputLines+i).toString().equals("yes")) intRight++;
}
if (intRight==tester.outputLines) str=str+"被测程序正确.\r\n";
else str=str+"被测程序错误.\r\n";
}
////////////////////////////////////////////////////
edit2.setText(str);
}
private void rdb2_click(Object source, Event e)
{
String tmpStr=new String();
tmpStr="函数说明:\r\n"+
"判断两个字符串是否完全相等\r\n"+
"输入要求:\r\n"+
"输入两行,分别表示两个字符串,字符串是英文字母,长度小于100,\r\n"+
"输出要求:\r\n"+
"输出一行,分别用wonderful表示相等,用bad表示不相等.\r\n"+
"例如:\r\n"+
"输入:\r\n"+
"xiaojun\r\n"+
"xiaodong\r\n"+
"输出:\r\n"+
"bad\r\n";
edit1.setText(tmpStr);
selected=2;
}
private void rdb3_click(Object source, Event e)
{
String tmpStr=new String();
tmpStr="函数说明:\r\n"+
"实现线形表查找中的二分查找法并在算法中加入排序算法,使输入键值无需事先按递增次序排好序就可实现查找.\r\n"+
"输入要求:\r\n"+
"输入一个具有5个结点的线形表\r\n"+
"输出要求:\r\n"+
"将输入键值用二分查找算法与线形表中5个结点作比较,如果找到相同键值,则查找成功,返回键值;如果没有找到相同键值,则查找失败,返回failed\r\n"+
"例如:\r\n"+
"输入:\r\n"+
"4 6 2 8 7\r\n"+
"2\r\n"+
"输出:\r\n"+
"2\r\n"+
"输入:\r\n"+
"4 6 2 8 7\r\n"+
"9\r\n"+
"输出:\r\n"+
"failed\r\n";
edit1.setText(tmpStr);
selected=3;
}
private void rdb4_click(Object source, Event e)
{
String tmpStr=new String();
tmpStr="函数说明:\r\n"+
"中序遍历,前序遍历\r\n"+
"输入要求:\r\n"+
"输入10个数\r\n"+
"输出要求:\r\n"+
"先输出中序再输出前序结果\r\n"+
"例如:\r\n"+
"输入:\r\n"+
"10 20 30 40 50 60 70 80 90 0\r\n"+
"输出:\r\n"+
"0 10 20 30 40 50 60 70 80 90 \r\n"+
"10 0 20 30 40 50 60 70 80 90\r\n";
edit1.setText(tmpStr);
selected=4;
}
private void rdb5_click(Object source, Event e)
{
String tmpStr=new String();
tmpStr="函数说明:\r\n"+
"输入十个不同的一位数字,分别用快速,冒泡,选择排序法进行排序,并输出排序结果,一行为一种排序的结果\r\n"+
"输入要求:\r\n"+
"输入十个不同的一位数字数字,每两个数字之间有一个空格,以回车键为结束符。\r\n"+
"输出要求:\r\n"+
"输出 1冒泡结果\r\n"+
" 2快速结果\r\n"+
" 3选择结果\r\n"+
"例如:\r\n"+
"输入:\r\n"+
"1 2 3 4 5 6 7 8 9 0\r\n"+
"输出:\r\n"+
"bub: 0 1 2 3 4 5 6 7 8 9\r\n"+
"qck: 0 1 2 3 4 5 6 7 8 9\r\n"+
"sel: 0 1 2 3 4 5 6 7 8 9\r\n";
edit1.setText(tmpStr);
selected=5;
}
private void rdb1_click(Object source, Event e)
{
String tmpStr=new String();
tmpStr="函数说明:\r\n"+
"建立二叉查找树,后序遍历及求树高\r\n"+
"输入要求:\r\n"+
"输入10个数\r\n"+
"输出要求:\r\n"+
"输出10个数字,每两个数字之间输入一个空格\r\n"+
"例如:\r\n"+
"输入:\r\n"+
"10 20 30 40 50 60 70 80 90 0\r\n"+
"输出:\r\n"+
"0 90 80 70 60 50 40 30 20 10\r\n"+
"The depth is:8\r\n";
edit1.setText(tmpStr);
selected=1;
}
private void rdb1_checkedChanged(Object source, Event e)
{
}
private void rdb2_checkedChanged(Object source, Event e)
{
}
private void menuItem4_click(Object source, Event e)
{
}
/**
* NOTE: The following code is required by the Visual J++ form
* designer. It can be modified using the form editor. Do not
* modify it using the code editor.
*/
Container components = new Container();
Edit edit2 = new Edit();
Label label1 = new Label();
Edit edit1 = new Edit();
PictureBox pictureBox1 = new PictureBox();
Button button2 = new Button();
GroupBox groupBox1 = new GroupBox();
GroupBox groupBox2 = new GroupBox();
RadioButton rdb5 = new RadioButton();
Label label6 = new Label();
GroupBox groupBox3 = new GroupBox();
MainMenu mainMenu1 = new MainMenu();
OpenFileDialog openFileDialog1 = new OpenFileDialog();
private void initForm()
{
edit2.setLocation(new Point(8, 24));
edit2.setSize(new Point(232, 336));
edit2.setTabIndex(0);
edit2.setText("测试结果");
edit2.setMultiline(true);
label1.setFont(new Font("宋体", 36.0f, FontSize.CHARACTERHEIGHT, FontWeight.NORMAL, false, false, false, CharacterSet.DEFAULT, 0));
label1.setLocation(new Point(168, 16));
label1.setSize(new Point(392, 36));
label1.setTabIndex(0);
label1.setTabStop(false);
label1.setText("程序自动测试程序系统");
label1.setAutoSize(true);
edit1.setLocation(new Point(8, 24));
edit1.setSize(new Point(264, 336));
edit1.setTabIndex(0);
edit1.setText("测试程序说明:");
edit1.setMultiline(true);
edit1.setScrollBars(ScrollBars.VERTICAL);
pictureBox1.setLocation(new Point(584, 8));
pictureBox1.setSize(new Point(80, 56));
pictureBox1.setTabIndex(1);
pictureBox1.setTabStop(false);
pictureBox1.setText("pictureBox1");
button2.setLocation(new Point(600, 488));
button2.setSize(new Point(120, 24));
button2.setTabIndex(2);
button2.setText("开始测试");
button2.addOnClick(new EventHandler(this.button2_click));
groupBox1.setLocation(new Point(480, 88));
groupBox1.setSize(new Point(248, 376));
groupBox1.setTabIndex(3);
groupBox1.setTabStop(false);
groupBox1.setText("测试报告");
groupBox2.setLocation(new Point(16, 88));
groupBox2.setSize(new Point(168, 376));
groupBox2.setTabIndex(4);
groupBox2.setTabStop(false);
groupBox2.setText("选择组员");
rdb5.setLocation(new Point(16, 56));
rdb5.setSize(new Point(128, 24));
rdb5.setTabIndex(0);
rdb5.setText("董仪俊(规范)");
rdb5.addOnClick(new EventHandler(this.rdb5_click));
label6.setLocation(new Point(16, 128));
label6.setSize(new Point(144, 96));
label6.setTabIndex(1);
label6.setTabStop(false);
label6.setText("选择,冒泡,快速排序");
groupBox3.setLocation(new Point(192, 88));
groupBox3.setSize(new Point(280, 376));
groupBox3.setTabIndex(5);
groupBox3.setTabStop(false);
groupBox3.setText("试题说明");
/* @designTimeOnly mainMenu1.setLocation(new Point(16, 32)); */
this.setText("C程序自动测试系统[课程设计]");
this.setAutoScaleBaseSize(new Point(6, 12));
this.setClientSize(new Point(742, 528));
this.setMenu(mainMenu1);
this.addOnClick(new EventHandler(this.Form1_click));
/* @designTimeOnly openFileDialog1.setLocation(new Point(16, 56)); */
this.setNewControls(new Control[] {
groupBox3,
groupBox2,
groupBox1,
button2,
pictureBox1,
label1});
groupBox1.setNewControls(new Control[] {
edit2});
groupBox2.setNewControls(new Control[] {
label6,
rdb5});
groupBox3.setNewControls(new Control[] {
edit1});
}
/**
* The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void main(String args[])
{
Application.run(new Form1());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -