54
54
import jpass .util .CryptUtils ;
55
55
import jpass .util .SpringUtilities ;
56
56
57
- import static jpass .ui .JPassFrame .localizedMessages ;
57
+ import static jpass .ui .JPassFrame .getLocalizedMessages ;
58
58
import static jpass .util .Constants .BUTTON_MESSAGE_ACCEPT ;
59
59
import static jpass .util .Constants .BUTTON_MESSAGE_CANCEL ;
60
60
import static jpass .util .Constants .BUTTON_MESSAGE_CLOSE ;
@@ -87,9 +87,9 @@ public final class GeneratePasswordDialog extends JDialog implements ActionListe
87
87
* Options for password generation.
88
88
*/
89
89
private static final String [][] PASSWORD_OPTIONS = {
90
- {localizedMessages .getString (VIEW_WINDOW_UPPER_CASE_LETTERS ), "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
91
- {localizedMessages .getString (VIEW_WINDOW_LOWER_CASE_LETTERS ), "abcdefghijklmnopqrstuvwxyz" },
92
- {localizedMessages .getString (VIEW_WINDOW_NUMBERS ), "0123456789" }
90
+ {getLocalizedMessages () .getString (VIEW_WINDOW_UPPER_CASE_LETTERS ), "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
91
+ {getLocalizedMessages () .getString (VIEW_WINDOW_LOWER_CASE_LETTERS ), "abcdefghijklmnopqrstuvwxyz" },
92
+ {getLocalizedMessages () .getString (VIEW_WINDOW_NUMBERS ), "0123456789" }
93
93
};
94
94
95
95
private JCheckBox [] checkBoxes ;
@@ -144,12 +144,12 @@ public GeneratePasswordDialog(JDialog parent) {
144
144
*/
145
145
private void initDialog (final Component parent , final boolean showAcceptButton ) {
146
146
setModal (true );
147
- setTitle (localizedMessages .getString (PASSWORD_GENERATE_PASSWORD ));
147
+ setTitle (getLocalizedMessages () .getString (PASSWORD_GENERATE_PASSWORD ));
148
148
setDefaultCloseOperation (WindowConstants .DISPOSE_ON_CLOSE );
149
149
this .generatedPassword = null ;
150
150
151
151
this .lengthPanel = new JPanel (new FlowLayout (FlowLayout .LEFT , 5 , 0 ));
152
- this .lengthLabel = new JLabel (String .format ("%s:" , localizedMessages .getString (PASSWORD_PASSWORD_LENGTH )));
152
+ this .lengthLabel = new JLabel (String .format ("%s:" , getLocalizedMessages () .getString (PASSWORD_PASSWORD_LENGTH )));
153
153
this .lengthPanel .add (this .lengthLabel );
154
154
155
155
int passwordGenerationLength = Configuration .getInstance ().getInteger ("default.password.generation.length" , 14 );
@@ -164,14 +164,14 @@ private void initDialog(final Component parent, final boolean showAcceptButton)
164
164
this .lengthPanel .add (this .lengthSpinner );
165
165
166
166
this .charactersPanel = new JPanel ();
167
- this .charactersPanel .setBorder (new TitledBorder (localizedMessages .getString (VIEW_WINDOW_SETTINGS )));
167
+ this .charactersPanel .setBorder (new TitledBorder (getLocalizedMessages () .getString (VIEW_WINDOW_SETTINGS )));
168
168
this .charactersPanel .add (this .lengthPanel );
169
169
this .checkBoxes = new JCheckBox [PASSWORD_OPTIONS .length ];
170
170
for (int i = 0 ; i < PASSWORD_OPTIONS .length ; i ++) {
171
171
this .checkBoxes [i ] = new JCheckBox (PASSWORD_OPTIONS [i ][0 ], true );
172
172
this .charactersPanel .add (this .checkBoxes [i ]);
173
173
}
174
- this .customSymbolsCheck = new JCheckBox (localizedMessages .getString (VIEW_WINDOW_CUSTOM_SYMBOLS ));
174
+ this .customSymbolsCheck = new JCheckBox (getLocalizedMessages () .getString (VIEW_WINDOW_CUSTOM_SYMBOLS ));
175
175
this .customSymbolsCheck .setActionCommand ("custom_symbols_check" );
176
176
this .customSymbolsCheck .addActionListener (this );
177
177
this .charactersPanel .add (this .customSymbolsCheck );
@@ -183,11 +183,11 @@ private void initDialog(final Component parent, final boolean showAcceptButton)
183
183
SpringUtilities .makeCompactGrid (this .charactersPanel , 6 , 1 , 5 , 5 , 5 , 5 );
184
184
185
185
this .passwordPanel = new JPanel (new BorderLayout ());
186
- this .passwordPanel .setBorder (new TitledBorder (localizedMessages .getString (PASSWORD_GENERATED_PASSWORD )));
186
+ this .passwordPanel .setBorder (new TitledBorder (getLocalizedMessages () .getString (PASSWORD_GENERATED_PASSWORD )));
187
187
188
188
this .passwordField = TextComponentFactory .newTextField ();
189
189
this .passwordPanel .add (this .passwordField , BorderLayout .NORTH );
190
- this .generateButton = new JButton (localizedMessages .getString (ENTRY_DIALOG_GENERATE_ENTRY ), MessageDialog .getIcon ("generate" ));
190
+ this .generateButton = new JButton (getLocalizedMessages () .getString (ENTRY_DIALOG_GENERATE_ENTRY ), MessageDialog .getIcon ("generate" ));
191
191
this .generateButton .setActionCommand ("generate_button" );
192
192
this .generateButton .addActionListener (this );
193
193
this .generateButton .setMnemonic (KeyEvent .VK_G );
@@ -198,15 +198,15 @@ private void initDialog(final Component parent, final boolean showAcceptButton)
198
198
this .buttonPanel = new JPanel (new FlowLayout (FlowLayout .RIGHT ));
199
199
200
200
if (showAcceptButton ) {
201
- this .acceptButton = new JButton (localizedMessages .getString (BUTTON_MESSAGE_ACCEPT ), MessageDialog .getIcon ("accept" ));
201
+ this .acceptButton = new JButton (getLocalizedMessages () .getString (BUTTON_MESSAGE_ACCEPT ), MessageDialog .getIcon ("accept" ));
202
202
this .acceptButton .setActionCommand ("accept_button" );
203
203
this .acceptButton .setMnemonic (KeyEvent .VK_A );
204
204
this .acceptButton .addActionListener (this );
205
205
this .buttonPanel .add (this .acceptButton );
206
206
207
- this .cancelButton = new JButton (localizedMessages .getString (BUTTON_MESSAGE_CANCEL ), MessageDialog .getIcon ("cancel" ));
207
+ this .cancelButton = new JButton (getLocalizedMessages () .getString (BUTTON_MESSAGE_CANCEL ), MessageDialog .getIcon ("cancel" ));
208
208
} else {
209
- this .cancelButton = new JButton (localizedMessages .getString (BUTTON_MESSAGE_CLOSE ), MessageDialog .getIcon ("close" ));
209
+ this .cancelButton = new JButton (getLocalizedMessages () .getString (BUTTON_MESSAGE_CLOSE ), MessageDialog .getIcon ("close" ));
210
210
}
211
211
212
212
this .cancelButton .setActionCommand ("cancel_button" );
@@ -247,7 +247,7 @@ public void actionPerformed(ActionEvent e) {
247
247
}
248
248
249
249
if (characterSet .isEmpty ()) {
250
- MessageDialog .showWarningMessage (this , localizedMessages .getString (PASSWORD_CAN_NOT_GENERATE_PASSWORD ));
250
+ MessageDialog .showWarningMessage (this , getLocalizedMessages () .getString (PASSWORD_CAN_NOT_GENERATE_PASSWORD ));
251
251
return ;
252
252
}
253
253
@@ -260,7 +260,7 @@ public void actionPerformed(ActionEvent e) {
260
260
} else if ("accept_button" .equals (command )) {
261
261
this .generatedPassword = this .passwordField .getText ();
262
262
if (this .generatedPassword .isEmpty ()) {
263
- MessageDialog .showWarningMessage (this , localizedMessages .getString (PASSWORD_GENERATE_PASSWORD_REQUEST ));
263
+ MessageDialog .showWarningMessage (this , getLocalizedMessages () .getString (PASSWORD_GENERATE_PASSWORD_REQUEST ));
264
264
return ;
265
265
}
266
266
dispose ();
0 commit comments