Mercurial > hg > Members > you > TreeVNC
annotate src/treeVnc/TextBoxProxy.java @ 22:24112133a0d9
add conf.txt src/treeVnc/ConfFileReader.java
author | Yu Taninari <you@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 20 Jan 2012 16:06:49 +0900 |
parents | 810c53d66376 |
children |
rev | line source |
---|---|
15 | 1 package treeVnc; |
2 | |
3 import javax.swing.*; | |
4 import java.awt.*; | |
5 import java.awt.event.*; | |
6 | |
7 public class TextBoxProxy extends JFrame implements ActionListener { | |
8 | |
21
810c53d66376
remove warning (Before the modifying)
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
15
diff
changeset
|
9 /** |
810c53d66376
remove warning (Before the modifying)
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
15
diff
changeset
|
10 * |
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 private static final long serialVersionUID = 1L; |
15 | 13 private JPanel panel; |
14 private JButton button; | |
15 private JButton button1; | |
16 private TextField t1; | |
17 private TextField t2; | |
18 private JPasswordField pw; | |
19 private double width; | |
20 private double height; | |
21 private JLabel label; | |
22 private boolean flag; | |
23 private VncProxyService vps; | |
24 | |
25 public void ipRegister() { | |
26 setSize(); | |
27 setText(); | |
28 visible(); | |
29 } | |
30 | |
31 public TextBoxProxy(VncProxyService _vps) { | |
32 vps = _vps; | |
33 setTitle("Informatin Connection Address"); | |
34 setResizable(false); | |
35 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
36 } | |
37 | |
38 private void setSize() { | |
39 Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); | |
40 width = (d.getWidth() / 2); | |
41 height = (d.getHeight() / 2); | |
42 } | |
43 | |
44 private void visible() { | |
45 Point point = new Point(); | |
46 point.setLocation(width - 250, height - 80); | |
47 setLocation(point.getLocation()); | |
48 pack(); | |
49 setVisible(true); | |
50 } | |
51 | |
52 private void init(){ | |
53 frameInit(); | |
54 // panel = null; | |
55 // button = null; | |
56 // label = null; | |
57 setVisible(false); | |
58 } | |
59 | |
60 public void changeHost() { | |
61 init(); | |
62 button1 = new JButton("Change Host"); | |
63 t1 = new TextField("Address", 30); | |
64 panel = new JPanel(); | |
65 panel.add(t1); | |
66 panel.add(button1); | |
67 button1.addActionListener(this); | |
68 label = new JLabel(); | |
69 Container contentPane = getContentPane(); | |
70 contentPane.add(panel, BorderLayout.CENTER); | |
71 contentPane.add(label, BorderLayout.SOUTH); | |
72 visible(); | |
73 } | |
74 | |
75 private void setText() { | |
76 panel = new JPanel(); | |
77 t1 = new TextField("localhost", 30); | |
78 t2 = new TextField("5900", 5); | |
22
24112133a0d9
add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
79 // pw = new JPasswordField("Password",30); |
15 | 80 button = new JButton("Connect"); |
81 panel.add(t1); | |
82 panel.add(t2); | |
22
24112133a0d9
add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
83 // panel.add(pw); |
15 | 84 panel.add(button); |
85 button.addActionListener(this); | |
86 label = new JLabel(); | |
87 Container contentPane = getContentPane(); | |
88 contentPane.add(panel, BorderLayout.CENTER); | |
89 contentPane.add(label, BorderLayout.SOUTH); | |
90 } | |
91 | |
92 public String getAddress() { | |
93 while(!(flag)) { | |
94 try { | |
95 Thread.sleep(500); | |
96 } catch (InterruptedException e) { | |
97 e.printStackTrace(); | |
98 } | |
99 } | |
100 return t1.getText(); | |
101 } | |
102 public String getPort() { | |
103 return t2.getText(); | |
104 } | |
105 | |
22
24112133a0d9
add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
106 |
15 | 107 public String getPassword() { |
108 return String.valueOf(pw.getPassword()); | |
109 } | |
110 | |
22
24112133a0d9
add conf.txt src/treeVnc/ConfFileReader.java
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
111 |
15 | 112 public void actionPerformed(ActionEvent e) { |
113 if(e.getSource()==button) { | |
114 flag = true; | |
115 setVisible(false); | |
116 } | |
117 if(e.getSource()==button1) | |
118 try { | |
119 init(); | |
120 vps.host = getAddress(); | |
121 vps.changeInit(); | |
122 } catch (Exception e1) { | |
123 e1.printStackTrace(); | |
124 } | |
125 } | |
126 } |