annotate src/treeVnc/TextBoxClient.java @ 15:578ea14c95e9

merge treeVnc
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Fri, 13 Jan 2012 13:38:38 +0900
parents
children 810c53d66376
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
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 public class TextBoxClient extends JFrame implements ActionListener, ItemListener {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 private JPanel panel = new JPanel();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 private JButton button = new JButton("Connect");
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 private TextField t1;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 private TextField t2;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 private double width = 750;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 private double height = 500;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 private JLabel label;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 private boolean flag;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 ArrayList<String> temp = new ArrayList<String>();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 private int counter = 0;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 //private JCheckBox[] check = new JCheckBox[20];
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 private Checkbox[] check = new Checkbox[20];
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 private boolean firstFlag = true;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 private String hostAddress;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 private String port;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 private CheckboxGroup ch = new CheckboxGroup();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 public void ipRegister() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 setSize();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 setText();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 visible();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 public TextBoxClient() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 setTitle("Informatin Connection Address");
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 setResizable(false);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
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
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 private void setSize() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 width = (d.getWidth() / 2);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 height = (d.getHeight() / 2);
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
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 void visible() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 Point point = new Point();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 point.setLocation(width - 250, height - 80);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 setLocation(point.getLocation());
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 pack();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 setVisible(true);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 public void unVisible() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 setVisible(false);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 }
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 private void setText() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 t1 = new TextField("Address", 30);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 t2 = new TextField("5999", 5);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 panel.add(t1);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 panel.add(t2);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 panel.add(button);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 button.addActionListener(this);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 label = new JLabel();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 Container contentPane = getContentPane();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 contentPane.add(panel, BorderLayout.CENTER);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 contentPane.add(label, BorderLayout.SOUTH);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 void checkBox(String str) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 //CheckboxGroup ch = new CheckboxGroup();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 if (counter == 0)
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 check[counter] = new Checkbox(str,true,ch);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 else
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 check[counter] = new Checkbox(str,false,ch);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 //check[counter].setBackground(new Color(0, 153, 255));
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 check[counter].addItemListener(this);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 panel.add(check[counter]);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 panel.setLayout(new GridLayout(counter + 2, 0));
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 panel.setLocation((int) width - 250, (int) height - 80);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 counter++;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 void setButton() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 panel.add(button);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 //panel.setBackground(Color.blue);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 button.addActionListener(this);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 Container contentPane = getContentPane();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 contentPane.add(panel, BorderLayout.CENTER);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 private void reportWindow() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 Container pane = getContentPane();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 JLabel label = new JLabel("Not found Proxy. If you use Client-mode you must set-up Proxy");
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 label.setPreferredSize(new Dimension(580,50));
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 label.setFont(new Font("Arial", Font.PLAIN, 20));
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 pane.add(label);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 public String getAddress() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 int i = 0;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 while (!(flag)) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 if (i >= 20) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 reportWindow();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 visible();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 break;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 try {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 Thread.sleep(500);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 } catch (InterruptedException e) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 e.printStackTrace();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 i++;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 return hostAddress;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 // return t1.getText();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 public String getPort() {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 return port;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 // return t2.getText();
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 public void actionPerformed(ActionEvent e) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 flag = true;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 for (int t = 0; t < counter; t++) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 if (check[t].getState()) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 System.out.println(check[t].getLabel());
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 setStatus(check[t].getLabel());
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 }
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 }
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
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 private void setStatus(String str) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 String[] temp = str.split(":");
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 port = temp[0];
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 System.out.println("port=" + port);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 hostAddress = temp[3];
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 String splitString(String str) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 String[] split = str.split("\\*");
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 String comper;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 if (split.length > 4) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 split[4] = null;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 comper = split[1] + split[3];
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 if (firstFlag) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 temp.add(comper);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 firstFlag = false;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 return "port:" + split[0] + ":host:" + split[1] + ":proxy:" + split[3];
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 for (int t = 0; t < temp.size(); t++) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 if (!(comper.equals(temp.get(t)))) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 if (t == temp.size() - 1) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 temp.add(comper);
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 return "port:" + split[0] + ":host:" + split[1] + ":proxy:" + split[3];
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 } else {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 break;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 return null;
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 @Override
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 public void itemStateChanged(ItemEvent e) {
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 }
578ea14c95e9 merge treeVnc
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 }