7
7
8
8
import java .awt .Panel ;
9
9
import java .awt .ScrollPane ;
10
+ import java .awt .event .ActionEvent ;
11
+ import java .awt .event .ActionListener ;
12
+ import java .io .InputStream ;
13
+ import java .io .PrintWriter ;
14
+ import java .net .Socket ;
10
15
import java .awt .Color ;
11
16
public class CacheInfoNodePanel extends objectPanel {
12
17
private static final long serialVersionUID = 1L ;
@@ -23,25 +28,46 @@ public CacheInfoNodePanel(final CacheInfoNodeRun thisrun){
23
28
label .setBounds (2 , 2 , 80 , 30 );
24
29
JTextField ipport = new JTextField ("xxx.xxx.xxx.xxx:xxxxx" , 18 );
25
30
ipport .setBounds (2 +85 , 2 , 200 , 30 );
26
-
31
+
27
32
JLabel labelName = new JLabel ("登录名称:" );
28
33
labelName .setBounds (2 , 2 +35 , 80 , 30 );
29
34
JTextField jTextFieldName = new JTextField ("输入用户名称" , 18 );
30
35
jTextFieldName .setBounds (2 +85 , 2 +35 , 200 , 30 );
31
-
36
+
32
37
JLabel labelPswd = new JLabel ("登录密码:" );
33
38
labelPswd .setBounds (2 , 2 +35 +35 , 80 , 30 );
34
39
JTextField jTextFieldPswd = new JTextField ("输入用户密码" , 18 );
35
40
jTextFieldPswd .setBounds (2 +85 , 2 +35 +35 , 200 , 30 );
36
41
//
37
42
JButton jbutton =new JButton ("确定" );
38
43
jbutton .setBounds (2 , 2 +35 +35 +35 , 80 , 30 );
44
+ jbutton .addActionListener (new ActionListener (){
45
+ public void actionPerformed (ActionEvent arg0 ) {
46
+ try {
47
+ String textOfLabelName = labelName .getText ();
48
+ String textOflabelPswd = labelPswd .getText ();
49
+ String textOfIpport = ipport .getText ();
50
+ Socket socket = new Socket (textOfIpport .split (":" )[0 ],Integer .valueOf (textOfIpport .split (":" )[1 ]));
51
+ PrintWriter os = new PrintWriter (socket .getOutputStream ());
52
+ //os.println("/111");
53
+ //添加输入值
54
+ os .flush ();
55
+ InputStream is = socket .getInputStream ();
56
+ byte [] bytes =new byte [1024 ];
57
+ while ((is .read (bytes , 0 , 1024 )) != -1 ) {
58
+ //System.out.println("1"+new String(bytes));
59
+ //得到输出值
60
+ }
61
+ }catch (Exception e ) {
62
+
63
+ }
64
+ }});
39
65
jp .add (labelName );
40
66
jp .add (jTextFieldName );
41
67
jp .add (labelPswd );
42
68
jp .add (jTextFieldPswd );
43
-
44
-
69
+
70
+
45
71
jp .add (label );
46
72
jp .add (ipport );
47
73
jp .add (jbutton );
0 commit comments