Mercurial > 510Connectbot
annotate src/net/sourceforge/jsocks/SocksDialog.java @ 349:205ee2873330
update jsocks to 2011-03-19
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Fri, 01 Aug 2014 11:23:10 -0700 |
parents | |
children |
rev | line source |
---|---|
349
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
1 package net.sourceforge.jsocks; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
2 import java.awt.*; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
3 import java.awt.event.*; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
4 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
5 /** |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
6 Socks configuration dialog.<br> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
7 Class which provides GUI means of getting CProxy configuration |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
8 from the user. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
9 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
10 public class SocksDialog extends Dialog |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
11 implements WindowListener, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
12 ItemListener, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
13 ActionListener, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
14 Runnable{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
15 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
16 //GUI components |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
17 TextField host_text, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
18 port_text, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
19 user_text, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
20 password_text, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
21 direct_text; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
22 Button add_button, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
23 remove_button, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
24 cancel_button, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
25 ok_button, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
26 dismiss_button; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
27 List direct_list; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
28 Checkbox socks4radio, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
29 socks5radio, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
30 none_check, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
31 up_check, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
32 gssapi_check; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
33 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
34 Dialog warning_dialog; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
35 Label warning_label; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
36 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
37 String host,user,password; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
38 int port; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
39 Thread net_thread = null; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
40 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
41 //CheckboxGroups |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
42 CheckboxGroup socks_group = new CheckboxGroup(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
43 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
44 CProxy proxy; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
45 InetRange ir; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
46 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
47 final static int COMMAND_MODE = 0; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
48 final static int OK_MODE = 1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
49 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
50 int mode; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
51 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
52 /**Wether to resolve addresses in separate thread. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
53 <p> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
54 Default value is true, however on some JVMs, namely one from |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
55 the Microsoft, it doesn't want to work properly, separate thread |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
56 can't close the dialog opened in GUI thread, and everuthing else |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
57 is then crashes. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
58 <p> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
59 When setting this variable to false, SocksDialog will block while |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
60 trying to look up proxy host, and if this takes considerable amount |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
61 of time it might be annoying to user. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
62 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
63 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
64 public static boolean useThreads = true; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
65 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
66 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
67 // Constructors |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
68 //////////////////////////////////// |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
69 /** |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
70 Creates SOCKS configuration dialog.<br> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
71 Uses default initialisation:<br> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
72 CProxy host: socks-proxy <br> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
73 CProxy port: 1080 <br> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
74 Version: 5<br> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
75 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
76 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
77 public SocksDialog(Frame parent){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
78 this(parent,null); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
79 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
80 /** |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
81 Creates SOCKS configuration dialog and initialises it |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
82 to given proxy. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
83 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
84 public SocksDialog(Frame parent,CProxy init_proxy){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
85 super(parent,"Proxy Configuration",true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
86 warning_dialog = new Dialog(parent,"Warning",true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
87 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
88 guiInit(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
89 setResizable(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
90 addWindowListener(this); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
91 Component[] comps = getComponents(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
92 for(int i=0;i<comps.length;++i){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
93 if(comps[i] instanceof Button) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
94 ((Button)comps[i]).addActionListener(this); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
95 else if(comps[i] instanceof TextField) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
96 ((TextField) comps[i]).addActionListener(this); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
97 else if(comps[i] instanceof Checkbox){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
98 ((Checkbox)comps[i]).addItemListener(this); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
99 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
100 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
101 proxy = init_proxy; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
102 if(proxy != null) doInit(proxy); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
103 else ir = new InetRange(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
104 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
105 dismiss_button.addActionListener(this); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
106 warning_dialog.addWindowListener(this); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
107 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
108 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
109 //Public Methods |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
110 //////////////// |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
111 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
112 /** |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
113 Displays SOCKS configuartion dialog. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
114 <p> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
115 Returns initialised proxy object, or null if user cancels dialog |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
116 by either pressing Cancel or closing the dialog window. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
117 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
118 public CProxy getProxy(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
119 mode = COMMAND_MODE; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
120 pack(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
121 show(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
122 return proxy; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
123 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
124 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
125 /** |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
126 Initialises dialog to given proxy and displays SOCKS configuartion dialog. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
127 <p> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
128 Returns initialised proxy object, or null if user cancels dialog |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
129 by either pressing Cancel or closing the dialog window. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
130 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
131 public CProxy getProxy(CProxy p){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
132 if(p != null){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
133 doInit(p); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
134 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
135 mode = COMMAND_MODE; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
136 pack(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
137 show(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
138 return proxy; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
139 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
140 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
141 // WindowListener Interface |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
142 ///////////////////////////////// |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
143 public void windowActivated(java.awt.event.WindowEvent e){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
144 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
145 public void windowDeactivated(java.awt.event.WindowEvent e){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
146 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
147 public void windowOpened(java.awt.event.WindowEvent e){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
148 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
149 public void windowClosing(java.awt.event.WindowEvent e){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
150 Window source = e.getWindow(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
151 if(source == this){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
152 onCancel(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
153 }else if(source == warning_dialog){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
154 onDismiss(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
155 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
156 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
157 public void windowClosed(java.awt.event.WindowEvent e){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
158 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
159 public void windowIconified(java.awt.event.WindowEvent e){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
160 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
161 public void windowDeiconified(java.awt.event.WindowEvent e){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
162 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
163 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
164 //ActionListener interface |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
165 /////////////////////////// |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
166 public void actionPerformed(ActionEvent ae){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
167 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
168 Object source = ae.getSource(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
169 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
170 if(source == cancel_button ) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
171 onCancel(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
172 else if(source == add_button || source == direct_text) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
173 onAdd(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
174 else if(source == remove_button) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
175 onRemove(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
176 else if(source == dismiss_button) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
177 onDismiss(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
178 else if(source == ok_button || source instanceof TextField) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
179 onOK(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
180 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
181 //ItemListener interface |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
182 //////////////////////// |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
183 public void itemStateChanged(ItemEvent ie){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
184 Object source = ie.getSource(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
185 //System.out.println("ItemEvent:"+source); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
186 if(source == socks5radio || source == socks4radio) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
187 onSocksChange(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
188 else if(source == up_check) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
189 onUPChange(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
190 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
191 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
192 //Runnable interface |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
193 //////////////////// |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
194 /** |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
195 Resolves proxy address in other thread, to avoid |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
196 annoying blocking in GUI thread. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
197 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
198 public void run(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
199 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
200 if(!initProxy()){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
201 //Check if we have been aborted |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
202 if(mode != OK_MODE) return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
203 if(net_thread != Thread.currentThread()) return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
204 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
205 mode = COMMAND_MODE; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
206 warning_label.setText("Look up failed."); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
207 warning_label.invalidate(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
208 return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
209 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
210 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
211 //System.out.println("Done!"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
212 while(!warning_dialog.isShowing()) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
213 ; /* do nothing*/; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
214 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
215 warning_dialog.dispose(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
216 //dispose(); //End Dialog |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
217 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
218 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
219 //Private Methods |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
220 /////////////////// |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
221 private void onOK(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
222 host = host_text.getText().trim(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
223 user = user_text.getText(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
224 password = password_text.getText(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
225 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
226 if(host.length() == 0){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
227 warn("Proxy host is not set!"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
228 return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
229 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
230 if(socks_group.getSelectedCheckbox() == socks4radio){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
231 if(user.length() == 0){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
232 warn("User name is not set"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
233 return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
234 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
235 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
236 }else{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
237 if(up_check.getState()){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
238 if(user.length() == 0){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
239 warn("User name is not set."); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
240 return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
241 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
242 if(password.length()==0){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
243 warn("Password is not set."); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
244 return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
245 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
246 }else if(!none_check.getState()){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
247 warn("Please select at least one Authentication Method."); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
248 return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
249 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
250 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
251 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
252 try{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
253 port = Integer.parseInt(port_text.getText()); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
254 }catch(NumberFormatException nfe){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
255 warn("Proxy port is invalid!"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
256 return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
257 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
258 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
259 mode = OK_MODE; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
260 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
261 if(useThreads){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
262 net_thread = new Thread(this); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
263 net_thread.start(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
264 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
265 info("Looking up host: "+host); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
266 //System.out.println("Info returned."); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
267 }else if(!initProxy()){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
268 warn("Proxy host is invalid."); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
269 mode = COMMAND_MODE; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
270 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
271 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
272 if(mode == OK_MODE) dispose(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
273 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
274 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
275 private void onCancel(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
276 //System.out.println("Cancel"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
277 proxy = null; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
278 dispose(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
279 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
280 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
281 private void onAdd(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
282 String s = direct_text.getText(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
283 s.trim(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
284 if(s.length() == 0 ) return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
285 //Check for Duplicate |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
286 String[] direct_hosts = direct_list.getItems(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
287 for(int i=0;i<direct_hosts.length;++i) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
288 if(direct_hosts[i].equals(s)) return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
289 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
290 direct_list.add(s); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
291 ir.add(s); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
292 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
293 private void onRemove(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
294 int index = direct_list.getSelectedIndex(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
295 if(index < 0) return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
296 ir.remove(direct_list.getItem(index)); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
297 direct_list.remove(index); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
298 direct_list.select(index); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
299 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
300 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
301 private void onSocksChange(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
302 Object selected = socks_group.getSelectedCheckbox(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
303 if(selected == socks4radio){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
304 user_text.setEnabled(true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
305 password_text.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
306 none_check.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
307 up_check.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
308 }else{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
309 if(up_check.getState()){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
310 user_text.setEnabled(true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
311 password_text.setEnabled(true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
312 }else{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
313 user_text.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
314 password_text.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
315 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
316 none_check.setEnabled(true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
317 up_check.setEnabled(true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
318 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
319 //System.out.println("onSocksChange:"+selected); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
320 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
321 private void onUPChange(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
322 //System.out.println("onUPChange"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
323 if(up_check.getState()){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
324 user_text.setEnabled(true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
325 password_text.setEnabled(true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
326 }else{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
327 user_text.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
328 password_text.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
329 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
330 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
331 private void onDismiss(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
332 warning_dialog.dispose(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
333 if(mode == OK_MODE){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
334 mode = COMMAND_MODE; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
335 if(net_thread!=null) net_thread.interrupt(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
336 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
337 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
338 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
339 private void doInit(CProxy p){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
340 if(p.version == 5){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
341 socks_group.setSelectedCheckbox(socks5radio); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
342 onSocksChange(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
343 if(((Socks5Proxy)p).getAuthenticationMethod(0)!=null) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
344 none_check.setState(true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
345 UserPasswordAuthentication auth = (UserPasswordAuthentication) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
346 ((Socks5Proxy)p).getAuthenticationMethod(2); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
347 if(auth!=null){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
348 user_text.setText(auth.getUser()); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
349 password_text.setText(auth.getPassword()); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
350 up_check.setState(true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
351 onUPChange(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
352 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
353 }else{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
354 socks_group.setSelectedCheckbox(socks4radio); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
355 onSocksChange(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
356 user_text.setText(((Socks4Proxy)p).user); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
357 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
358 ir = (InetRange)(p.directHosts.clone()); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
359 String[] direct_hosts = ir.getAll(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
360 direct_list.removeAll(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
361 for(int i=0;i<direct_hosts.length;++i) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
362 direct_list.add(direct_hosts[i]); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
363 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
364 host_text.setText(p.proxyIP.getHostName()); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
365 port_text.setText(""+p.proxyPort); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
366 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
367 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
368 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
369 private boolean initProxy(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
370 try{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
371 if(socks_group.getSelectedCheckbox() == socks5radio){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
372 proxy = new Socks5Proxy(host,port); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
373 if(up_check.getState()) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
374 ((Socks5Proxy)proxy).setAuthenticationMethod(2, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
375 new UserPasswordAuthentication(user,password)); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
376 if(!none_check.getState()) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
377 ((Socks5Proxy)proxy).setAuthenticationMethod(0,null); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
378 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
379 else |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
380 proxy = new Socks4Proxy(host,port,user); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
381 }catch(java.net.UnknownHostException uhe){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
382 return false; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
383 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
384 proxy.directHosts = ir; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
385 return true; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
386 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
387 private void info(String s){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
388 msgBox("Info",s); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
389 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
390 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
391 private void warn(String s){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
392 msgBox("Warning",s); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
393 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
394 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
395 private void msgBox(String title, String message){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
396 warning_label.setText(message); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
397 warning_label.invalidate(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
398 warning_dialog.setTitle(title); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
399 warning_dialog.pack(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
400 warning_dialog.show(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
401 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
402 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
403 /*====================================================================== |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
404 Form: |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
405 Table: |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
406 +---+-------+---+---+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
407 | | | | | |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
408 +---+-------+---+---+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
409 | | | |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
410 +---+-------+-------+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
411 | | | | |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
412 +---+-------+-------+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
413 | | | | |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
414 +---+-------+-------+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
415 | | | |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
416 +-----------+-------+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
417 | | | |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
418 | +---+---+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
419 | | | | |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
420 +-----------+---+---+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
421 | | | | |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
422 +---+---+---+---+---+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
423 | | | | | | |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
424 +---+---+---+---+---+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
425 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
426 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
427 void guiInit(){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
428 //Some default names used |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
429 Label label; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
430 Container container; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
431 Font font; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
432 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
433 GridBagConstraints c = new GridBagConstraints(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
434 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
435 font = new Font("Dialog",Font.PLAIN,12); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
436 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
437 container = this; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
438 //container = new Panel(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
439 container.setLayout(new GridBagLayout()); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
440 container.setFont(font); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
441 container.setBackground(SystemColor.menu); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
442 c.insets = new Insets(3,3,3,3); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
443 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
444 c.gridx=0; c.gridy=0; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
445 c.gridwidth=1; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
446 c.anchor=GridBagConstraints.NORTHEAST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
447 label = new Label("Host:"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
448 container.add(label,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
449 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
450 c.gridx=1; c.gridy=0; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
451 c.gridwidth=2; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
452 c.anchor=GridBagConstraints.NORTHWEST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
453 host_text = new TextField("socks-proxy",15); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
454 container.add(host_text,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
455 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
456 c.gridx=3; c.gridy=0; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
457 c.gridwidth=1; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
458 c.anchor=GridBagConstraints.NORTHEAST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
459 label = new Label("Port:"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
460 container.add(label,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
461 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
462 c.gridx=4; c.gridy=0; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
463 c.gridwidth=1; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
464 c.anchor=GridBagConstraints.NORTHWEST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
465 port_text = new TextField("1080",5); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
466 container.add(port_text,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
467 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
468 c.gridx=0; c.gridy=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
469 c.gridwidth=3; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
470 c.anchor=GridBagConstraints.NORTH; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
471 socks4radio = new Checkbox("Socks4",socks_group,false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
472 //1.0 compatible code |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
473 //socks4radio = new Checkbox("Socks4",false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
474 //socks4radio.setCheckboxGroup(socks_group); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
475 socks4radio.setFont(new Font(font.getName(),Font.BOLD,14)); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
476 container.add(socks4radio,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
477 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
478 c.gridx=3; c.gridy=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
479 c.gridwidth=2; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
480 c.anchor=GridBagConstraints.NORTH; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
481 socks5radio = new Checkbox("Socks5",socks_group,true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
482 //1.0 compatible code |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
483 //socks5radio = new Checkbox("Socks5",true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
484 //socks5radio.setCheckboxGroup(socks_group); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
485 socks5radio.setFont(new Font(font.getName(),Font.BOLD,14)); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
486 container.add(socks5radio,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
487 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
488 c.gridx=0; c.gridy=2; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
489 c.gridwidth=1; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
490 c.anchor=GridBagConstraints.EAST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
491 label = new Label("User Id:"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
492 container.add(label,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
493 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
494 c.gridx=1; c.gridy=2; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
495 c.gridwidth=2; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
496 c.anchor=GridBagConstraints.NORTHWEST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
497 user_text = new TextField("",15); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
498 user_text.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
499 container.add(user_text,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
500 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
501 c.gridx=3; c.gridy=2; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
502 c.gridwidth=2; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
503 c.anchor=GridBagConstraints.NORTH; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
504 label = new Label("Authentication"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
505 label.setFont(new Font(font.getName(),Font.BOLD,14)); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
506 container.add(label,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
507 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
508 c.gridx=0; c.gridy=3; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
509 c.gridwidth=1; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
510 c.anchor=GridBagConstraints.EAST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
511 label = new Label("Password:"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
512 container.add(label,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
513 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
514 c.gridx=1; c.gridy=3; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
515 c.gridwidth=2; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
516 c.anchor=GridBagConstraints.NORTHWEST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
517 password_text = new TextField("",15); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
518 password_text.setEchoChar('*'); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
519 password_text.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
520 //password_text.setEchoCharacter('*');//1.0 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
521 container.add(password_text,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
522 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
523 c.gridx=3; c.gridy=3; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
524 c.gridwidth=2; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
525 c.anchor=GridBagConstraints.NORTHWEST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
526 none_check = new Checkbox("None",true); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
527 container.add(none_check,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
528 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
529 c.gridx=0; c.gridy=4; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
530 c.gridwidth=3; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
531 c.anchor=GridBagConstraints.NORTH; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
532 label = new Label("Direct Hosts"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
533 label.setFont(new Font(font.getName(),Font.BOLD,14)); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
534 container.add(label,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
535 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
536 c.gridx=3; c.gridy=4; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
537 c.gridwidth=2; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
538 c.anchor=GridBagConstraints.NORTHWEST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
539 up_check = new Checkbox("User/Password",false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
540 container.add(up_check,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
541 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
542 c.gridx=0; c.gridy=5; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
543 c.gridwidth=3; c.gridheight=2; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
544 c.anchor=GridBagConstraints.NORTHWEST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
545 c.fill = GridBagConstraints.BOTH; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
546 direct_list = new List(3); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
547 container.add(direct_list,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
548 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
549 c.gridx=3; c.gridy=5; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
550 c.gridwidth=2; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
551 c.anchor=GridBagConstraints.NORTHWEST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
552 gssapi_check = new Checkbox("GSSAPI",false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
553 gssapi_check.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
554 container.add(gssapi_check,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
555 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
556 c.gridx=0; c.gridy=7; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
557 c.gridwidth=3; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
558 c.anchor=GridBagConstraints.NORTHWEST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
559 direct_text = new TextField("",25); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
560 container.add(direct_text,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
561 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
562 c.gridx=3; c.gridy=7; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
563 c.gridwidth=1; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
564 c.anchor=GridBagConstraints.NORTH; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
565 add_button = new Button("Add"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
566 container.add(add_button,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
567 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
568 c.gridx=3; c.gridy=6; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
569 c.gridwidth=1; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
570 c.anchor=GridBagConstraints.NORTH; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
571 remove_button = new Button("Remove"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
572 container.add(remove_button,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
573 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
574 c.gridx=1; c.gridy=8; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
575 c.gridwidth=1; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
576 c.anchor=GridBagConstraints.NORTH; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
577 cancel_button = new Button("Cancel"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
578 container.add(cancel_button,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
579 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
580 c.gridx=0; c.gridy=8; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
581 c.gridwidth=1; c.gridheight=1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
582 c.anchor=GridBagConstraints.NORTHWEST; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
583 ok_button = new Button("OK"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
584 container.add(ok_button,c); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
585 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
586 //up_check.setEnabled(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
587 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
588 //Warning Dialog |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
589 dismiss_button = new Button("Dismiss"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
590 warning_label = new Label("",Label.CENTER); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
591 warning_label.setFont(new Font("Dialog",Font.BOLD,15)); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
592 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
593 Panel p = new Panel(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
594 p.add(dismiss_button); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
595 warning_dialog.add(p,BorderLayout.SOUTH); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
596 warning_dialog.add(warning_label,BorderLayout.CENTER); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
597 warning_dialog.setResizable(false); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
598 }//end guiInit |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
599 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
600 /* |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
601 // Main |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
602 //////////////////////////////////// |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
603 public static void main(String[] args) throws Exception{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
604 Frame f = new Frame("Test for SocksDialog"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
605 f.add("Center", new Label("Fill the Dialog")); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
606 SocksDialog socksdialog = new SocksDialog(f); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
607 f.pack(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
608 f.show(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
609 f.addWindowListener(socksdialog); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
610 CProxy p = socksdialog.getProxy(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
611 System.out.println("Selected: "+p); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
612 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
613 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
614 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
615 }//end class |