forked from dreamer-89-zz/complexity-measure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mutation_Testing2.java
82 lines (79 loc) · 2.21 KB
/
Mutation_Testing2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package software_testing_meaures;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionListener;
import java.net.*;
import javax.swing.JLabel;
/**
*
* @author Suraj Singh
*/
class Mutation_Testing2 extends Applet implements ActionListener
{
TextField input,output;
Label label1,label2;
Button b1;
JLabel lbl;
int num, sum = 0;
public void init()
{
String link = "google";
Button b = new Button(link);
//b.add();
b.addActionListener(this);
add(b);
Label label1,label2;
TextField input,output;
Button b1;
JLabel lbl;
label1 = new Label("please enter number : ");
add(label1);
label1.setBackground(Color.yellow);
label1.setForeground(Color.magenta);
input = new TextField(5);
add(input);
label2 = new Label("Sum : ");
add(label2);
label2.setBackground(Color.yellow);
label2.setForeground(Color.magenta);
output = new TextField(20);
add(output);
b1 = new Button("Add");
add(b1);
b1.addActionListener(this);
lbl = new JLabel("Swing Applet Example. ");
add(lbl);
setBackground(Color.yellow);
}
public void actionPerformed(ActionEvent ae){
try{
num = Integer.parseInt(input.getText());
sum = sum+num;
input.setText("");
output.setText(Integer.toString(sum));
lbl.setForeground(Color.blue);
lbl.setText("Output of the second Text Box : "
+ output.getText());
}
catch(NumberFormatException e){
lbl.setForeground(Color.red);
lbl.setText("Invalid Entry!");
}
Button source = (Button)ae.getSource();
String link = "http://www."+source.getLabel()+".com";
try{
AppletContext a = getAppletContext();
URL url = new URL(link);
a.showDocument(url, "_blank");
}
catch(MalformedURLException e)
{
System.out.println(e.getMessage());
}
}