1 // re/mind - Remote Reminder Software
2 // Copyright (C) 2002 Moritz Petersen
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 //
18 // $Id: UserPreferencesFrame.java,v 1.1.1.1 2002/09/29 17:26:03 powerpete Exp $
19 package de.jface.remind.awtui;
20
21 import de.jface.remind.Config;
22
23 import java.awt.Dialog;
24 import java.awt.Frame;
25 import java.awt.GridLayout;
26 import java.awt.Label;
27 import java.awt.TextField;
28 import java.awt.event.TextEvent;
29 import java.awt.event.TextListener;
30 import java.awt.event.WindowAdapter;
31 import java.awt.event.WindowEvent;
32
33 /***
34 * Class <code>UserPreferencesFrame</code>
35 * of project RemotePostIt.
36 *
37 * @author Moritz Petersen
38 * @version $Revision: 1.1.1.1 $
39 */
40 public class UserPreferencesFrame
41 extends Dialog
42 {
43 private String user;
44 private String host;
45 private String password;
46
47 public UserPreferencesFrame()
48 {
49 super(new Frame(), Config.USER_PREFERENCES_FRAME_TITLE, true);
50 setLayout(new GridLayout(6, 1, 12, 6));
51 add(new UserLabel());
52 add(new UserTextField());
53 add(new PasswordLabel());
54 add(new PasswordTextField());
55 add(new HostLabel());
56 add(new HostTextField());
57 pack();
58 setResizable(false);
59
60 addWindowListener(new WindowAdapter()
61 {
62 public void windowClosing(WindowEvent e)
63 {
64 setVisible(false);
65 dispose();
66 }
67 });
68
69 setVisible(true);
70 }
71
72 public String getUser()
73 {
74 return user;
75 }
76
77 public String getHost()
78 {
79 return host;
80 }
81
82 public String getPassword()
83 {
84 return password;
85 }
86
87 private class UserPreferencesLabel
88 extends Label
89 {
90 public UserPreferencesLabel(String label)
91 {
92 super(label);
93 }
94 }
95
96 private class UserLabel extends UserPreferencesLabel
97 {
98 public UserLabel()
99 {
100 super(Config.USER_PREFERENCES_FRAME_USER_LABEL);
101 }
102 }
103
104 private class HostLabel extends UserPreferencesLabel
105 {
106 public HostLabel()
107 {
108 super(Config.USER_PREFERENCES_FRAME_HOST_LABEL);
109 }
110 }
111
112 private class PasswordLabel
113 extends UserPreferencesLabel
114 {
115 public PasswordLabel()
116 {
117 super(Config.USER_PREFERENCES_FRAME_PASSWORD_LABEL);
118 }
119 }
120
121 private abstract class UserPreferencesTextField
122 extends TextField
123 {
124 public UserPreferencesTextField()
125 {
126 super(40);
127 addTextListener(new TextListener()
128 {
129 public void textValueChanged(TextEvent e)
130 {
131 textChanged();
132 }
133 });
134 }
135
136 protected abstract void textChanged();
137 }
138
139 private class UserTextField
140 extends UserPreferencesTextField
141 {
142 protected void textChanged()
143 {
144 user = getText();
145 }
146 }
147
148 private class HostTextField
149 extends UserPreferencesTextField
150 {
151 protected void textChanged()
152 {
153 host = getText();
154 }
155 }
156
157 private class PasswordTextField
158 extends UserPreferencesTextField
159 {
160 public PasswordTextField()
161 {
162 super();
163 setEchoChar('¥');
164 }
165
166 protected void textChanged()
167 {
168 password = getText();
169 }
170 }
171 }
172
173 // ------1---------2---------3---------4---------5---------6---------7---------8
This page was automatically generated by Maven