25 |
* |
* |
26 |
* Contributors: |
* Contributors: |
27 |
* Martin O. J. Schmitz - initial API and implementation |
* Martin O. J. Schmitz - initial API and implementation |
28 |
* Stefan A. Krüger - additional utility classes |
* Stefan A. Tzeggai - additional utility classes |
29 |
******************************************************************************/ |
******************************************************************************/ |
30 |
package skrueger.i8n; |
package skrueger.i8n; |
31 |
|
|
62 |
public class SwitchLanguageDialog extends JDialog { |
public class SwitchLanguageDialog extends JDialog { |
63 |
protected Logger LOGGER = Logger.getLogger(SwitchLanguageDialog.class); |
protected Logger LOGGER = Logger.getLogger(SwitchLanguageDialog.class); |
64 |
|
|
|
private static final long serialVersionUID = 1L; |
|
|
|
|
65 |
private JPanel jContentPane = null; |
private JPanel jContentPane = null; |
66 |
|
|
67 |
private JLabel jLabelFlagimage = null; |
private JLabel jLabelFlagimage = null; |
81 |
/** |
/** |
82 |
* A dialog to select one of the available languages. If only one language |
* A dialog to select one of the available languages. If only one language |
83 |
* is available, select it directly. Creating this object automatically |
* is available, select it directly. Creating this object automatically |
84 |
* makes it visible. |
* makes it visible, unless there is only one language to choose from.. it |
85 |
* |
* that case it disposes itself automatically. |
|
* @param owner |
|
|
* @param atlasConfig |
|
86 |
*/ |
*/ |
87 |
public SwitchLanguageDialog(final Component owner, |
public SwitchLanguageDialog(final Component owner, |
88 |
final List<String> languages) { |
final List<String> languages) { |
94 |
if (languages.size() == 1) { |
if (languages.size() == 1) { |
95 |
LOGGER.debug("Only language '" + languages.get(0) |
LOGGER.debug("Only language '" + languages.get(0) |
96 |
+ "' is available. It has been selected automatically."); |
+ "' is available. It has been selected automatically."); |
97 |
|
// dispose(); |
98 |
|
setModal(false); |
99 |
return; |
return; |
100 |
} |
} |
101 |
|
|
109 |
*/ |
*/ |
110 |
private void initialize() { |
private void initialize() { |
111 |
this.setContentPane(getJContentPane()); |
this.setContentPane(getJContentPane()); |
|
setModal(true); |
|
|
SwingUtil.centerFrameOnScreenRandom(this); |
|
112 |
|
|
113 |
setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); |
setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); |
114 |
|
|
115 |
pack(); |
pack(); |
116 |
|
|
117 |
|
SwingUtil.centerFrameOnScreenRandom(this); |
118 |
|
setModal(true); |
119 |
|
setVisible(true); |
120 |
} |
} |
121 |
|
|
122 |
/** |
/** |
213 |
gridBagConstraints.gridy = 0; |
gridBagConstraints.gridy = 0; |
214 |
jLabel = new JLabel(); |
jLabel = new JLabel(); |
215 |
jLabel.setText("Select language: "); // i8n!?! Maybe replace with an |
jLabel.setText("Select language: "); // i8n!?! Maybe replace with an |
216 |
// icon of an index finger |
// icon of an index finger |
217 |
jPanel1 = new JPanel(); |
jPanel1 = new JPanel(); |
218 |
jPanel1.setLayout(new GridBagLayout()); |
jPanel1.setLayout(new GridBagLayout()); |
219 |
jPanel1.add(jLabel, gridBagConstraints); |
jPanel1.add(jLabel, gridBagConstraints); |
286 |
return jComboBox; |
return jComboBox; |
287 |
} |
} |
288 |
|
|
289 |
} |
} |