annotate src/treeVnc/TextBoxClient.java @ 62:b2492abdae2a Version1.0 tip

Added tag TreeVNC_version1.0 for changeset 318ec7415073
author Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
date Sun, 12 Aug 2012 22:13:39 +0900
parents 32b266967c2c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 package treeVnc;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 import javax.swing.*;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 import java.awt.*;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 import java.awt.event.*;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 import java.util.ArrayList;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
8 public class TextBoxClient extends JFrame implements ActionListener,
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
9 ItemListener {
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
21
810c53d66376 remove warning (Before the modifying)
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
11 /**
810c53d66376 remove warning (Before the modifying)
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
12 *
810c53d66376 remove warning (Before the modifying)
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
13 */
810c53d66376 remove warning (Before the modifying)
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
14 private static final long serialVersionUID = 1L;
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 private JPanel panel = new JPanel();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 private JButton button = new JButton("Connect");
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 private TextField t1;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 private TextField t2;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 private double width = 750;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 private double height = 500;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 private JLabel label;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 private boolean flag;
24
one
parents: 22
diff changeset
23 private ArrayList<String> temp = new ArrayList<String>();
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 private int counter = 0;
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
25 // private JCheckBox[] check = new JCheckBox[20];
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 private Checkbox[] check = new Checkbox[20];
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 private boolean firstFlag = true;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 private String hostAddress;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 private String port;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 private CheckboxGroup ch = new CheckboxGroup();
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
31
22
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
32 public TextBoxClient() {
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
33 setTitle("Informatin Connection Address");
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
34 setResizable(false);
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
35 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
36 }
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 public void ipRegister() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 setSize();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 setText();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 visible();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 private void setSize() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 width = (d.getWidth() / 2);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 height = (d.getHeight() / 2);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 void visible() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 Point point = new Point();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 point.setLocation(width - 250, height - 80);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 setLocation(point.getLocation());
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 pack();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 setVisible(true);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 public void unVisible() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 setVisible(false);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 private void setText() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 t1 = new TextField("Address", 30);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 t2 = new TextField("5999", 5);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 panel.add(t1);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 panel.add(t2);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 panel.add(button);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 button.addActionListener(this);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 label = new JLabel();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 Container contentPane = getContentPane();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 contentPane.add(panel, BorderLayout.CENTER);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 contentPane.add(label, BorderLayout.SOUTH);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 void checkBox(String str) {
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
76 // CheckboxGroup ch = new CheckboxGroup();
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 if (counter == 0)
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
78 check[counter] = new Checkbox(str, true, ch);
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 else
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
80 check[counter] = new Checkbox(str, false, ch);
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
81 // check[counter].setBackground(new Color(0, 153, 255));
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 check[counter].addItemListener(this);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 panel.add(check[counter]);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 panel.setLayout(new GridLayout(counter + 2, 0));
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 panel.setLocation((int) width - 250, (int) height - 80);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 counter++;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88
31
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
89 public void setButton() {
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 panel.add(button);
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
91 // panel.setBackground(Color.blue);
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 button.addActionListener(this);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 Container contentPane = getContentPane();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 contentPane.add(panel, BorderLayout.CENTER);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 private void reportWindow() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 Container pane = getContentPane();
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
100 JLabel label = new JLabel(
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
101 "Not found Proxy. If you use Client-mode you must set-up Proxy");
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
102 label.setPreferredSize(new Dimension(580, 50));
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 label.setFont(new Font("Arial", Font.PLAIN, 20));
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 pane.add(label);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 }
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
106
22
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
107 public String getAddressOption() {
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
108 while (!(flag)) {
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
109 try {
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
110 Thread.sleep(500);
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
111 } catch (InterruptedException e) {
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
112 e.printStackTrace();
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
113 }
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
114 }
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
115 return t1.getText();
22
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
116 }
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 public String getAddress() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 int i = 0;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 while (!(flag)) {
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
121 if (i >= 50) {
34
32b266967c2c delete notfound window
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 31
diff changeset
122 /*
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 reportWindow();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 visible();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 break;
34
32b266967c2c delete notfound window
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 31
diff changeset
126 */
32b266967c2c delete notfound window
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 31
diff changeset
127 return "notFound";
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 try {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 Thread.sleep(500);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 } catch (InterruptedException e) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 e.printStackTrace();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 i++;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 return hostAddress;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 // return t1.getText();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 }
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
139
22
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
140 public String getPortOption() {
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
141 return t2.getText();
24112133a0d9 add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
142 }
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
143
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 public String getPort() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 return port;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 // return t2.getText();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 public void actionPerformed(ActionEvent e) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 flag = true;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 for (int t = 0; t < counter; t++) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 if (check[t].getState()) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 System.out.println(check[t].getLabel());
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
154 // if(int t =0)
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
155 setStatus(check[t].getLabel());
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
156 unVisible();
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
157 // else
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
158 // setStatus()
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 private void setStatus(String str) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 String[] temp = str.split(":");
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
165 if (temp.length == 2) {
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
166 hostAddress = temp[0];
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
167 port = temp[1];
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
168 } else {
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
169 port = temp[0];
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
170 System.out.println("port=" + port);
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
171 hostAddress = temp[3];
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
172 }
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 }
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
174
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 String splitString(String str) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 String[] split = str.split("\\*");
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 String comper;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 if (split.length > 4) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 split[4] = null;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 comper = split[1] + split[3];
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 if (firstFlag) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 temp.add(comper);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 firstFlag = false;
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
185 return "port:" + split[0] + ":host:" + split[1] + ":proxy:"
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
186 + split[3];
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 for (int t = 0; t < temp.size(); t++) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 if (!(comper.equals(temp.get(t)))) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 if (t == temp.size() - 1) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 temp.add(comper);
27
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
192 return "port:" + split[0] + ":host:" + split[1] + ":proxy:"
41b2e2ebcff2 modify AcceptClient.java
one
parents: 26
diff changeset
193 + split[3];
15
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 } else {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 break;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 return null;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 public void itemStateChanged(ItemEvent e) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 }