2 |
* Copyright (c) 2009 Martin O. J. Schmitz. |
* Copyright (c) 2009 Martin O. J. Schmitz. |
3 |
* |
* |
4 |
* This file is part of the SCHMITZM library - a collection of utility |
* This file is part of the SCHMITZM library - a collection of utility |
5 |
* classes based on Java 1.6, focussing (not only) on Java Swing |
* classes based on Java 1.6, focusing (not only) on Java Swing |
6 |
* and the Geotools library. |
* and the Geotools library. |
7 |
* |
* |
8 |
* The SCHMITZM project is hosted at: |
* The SCHMITZM project is hosted at: |
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 |
|
|
33 |
import java.awt.GridBagConstraints; |
import java.awt.GridBagConstraints; |
34 |
import java.awt.GridBagLayout; |
import java.awt.GridBagLayout; |
35 |
import java.awt.Insets; |
import java.awt.Insets; |
|
import java.awt.Window; |
|
36 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
37 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
38 |
import java.awt.event.MouseWheelListener; |
import java.awt.event.MouseWheelListener; |
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 |
} // @jve:decl-index=0:visual-constraint="0,0" |
} |