-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathframe2.java
205 lines (180 loc) · 5.48 KB
/
frame2.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.miginfocom.swing.MigLayout;
import javax.swing.JButton;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import com.jgoodies.forms.factories.FormFactory;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.CardLayout;
import javax.swing.JPopupMenu;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.swing.JMenu;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import com.jgoodies.forms.factories.DefaultComponentFactory;
import javax.swing.Box;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JTextArea;
import javax.swing.JTree;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.JScrollPane;
public class frame2 extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
// JFrame mainFrame;
public static void main(String[] args) {
try{
UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
}
catch(Exception e){
e.printStackTrace();
}
frame2 frame_2 = new frame2();
// frame_2
// frame_2.runFrame(frame_2);
// EventQueue.invokeLater(new Runnable() {
// public void run() {
// try {
// frame2 frame = new frame2();
// frame.setVisible(true);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// });
}
// public void runFrame(frame2 frame_2){
// EventQueue.invokeLater(new Runnable() {
// public void run() {
// try {
//// frame2 frame = new frame2();
// frame_2.setVisible(true);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// });
// }
/**
* Create the frame.
*/
public frame2() {
frame2 frame2_temp = this;
this.setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(144, 11, 280, 239);
contentPane.add(scrollPane);
JTextArea textArea1 = new JTextArea();
scrollPane.setViewportView(textArea1);
JButton btnNewButton = new JButton("Start Selenium");
btnNewButton.setToolTipText("Starting selenium server");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Runtime.getRuntime().exec("cmd /c start \"C:\\selenium\\selenium.bat\"");
System.out.println("Selenium started");
} catch (IOException ex) {
ex.printStackTrace();
}
textArea1.append("Selenium is running successfully \n");
}
});
btnNewButton.setBounds(16, 46, 122, 23);
contentPane.add(btnNewButton);
JButton btnNewButton_1 = new JButton("Start Xampp");
btnNewButton_1.setToolTipText("Starting the Xampp server");
btnNewButton_1.setBounds(16, 72, 122, 23);
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(btnNewButton_1.getText() == "Start Xampp"){
textArea1.append("Xampp has started successfully \n");
btnNewButton_1.setText("Stop Xampp ");
String command = "C:\\xampp\\xampp_start.exe";
Process p = null;
try {
p = Runtime.getRuntime().exec("cmd /c "+command);
//System.out.println("running xampp");
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
BufferedReader reader = new BufferedReader(
new InputStreamReader(p.getInputStream()));
textArea1.setText("");
String line = null;
try {
line = reader.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
while (line != null) {
// System.out.println(line);
textArea1.append(line+"\n");
try {
line = reader.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
else{
textArea1.append("Xampp is stopped successfully \n");
btnNewButton_1.setText("Start Xampp");
String command = "C:\\xampp\\xampp_stop.exe";
try {
Runtime.getRuntime().exec("cmd /c "+command);
System.out.println("stopping xampp");
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
});
contentPane.add(btnNewButton_1);
JButton btnNewButton_2 = new JButton("Go Testing");
btnNewButton_2.setToolTipText("Go to testing pannel");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//frame3 newFrame = new frame3();
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
frame3 frame_3 = new frame3(frame2_temp);
frame_3.setVisible(true);
frame2_temp.setVisible(false);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
});
btnNewButton_2.setBounds(16, 98, 122, 23);
contentPane.add(btnNewButton_2);
}
}