72 |
/** |
/** |
73 |
* Remembers all {@link JTextField} that have been created. |
* Remembers all {@link JTextField} that have been created. |
74 |
*/ |
*/ |
75 |
private Set<JTextField> langTextFields = new HashSet<JTextField>(); |
private Set<TranslationJTextField> langTextFields = new HashSet<TranslationJTextField>(); |
|
|
|
76 |
private WeakHashMap<ActionListener, ActionListener> actionListeners = new WeakHashMap<ActionListener, ActionListener>(); |
private WeakHashMap<ActionListener, ActionListener> actionListeners = new WeakHashMap<ActionListener, ActionListener>(); |
77 |
|
|
78 |
/** |
/** |
106 |
.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
107 |
add(questionLable, BorderLayout.NORTH); |
add(questionLable, BorderLayout.NORTH); |
108 |
} |
} |
109 |
|
|
110 |
|
/** |
111 |
|
* Add listeners |
112 |
|
*/ |
113 |
|
} |
114 |
|
|
115 |
|
/** |
116 |
|
* Creates a {@link JPanel} that asks the user for the translation of a |
117 |
|
* String in several languages and additionally puts a {@link JLabel} with a |
118 |
|
* question at the {@link JPanel}'s first row. |
119 |
|
* |
120 |
|
* <br/> |
121 |
|
* This constructor also sets a TitledBorder with the given title. |
122 |
|
*/ |
123 |
|
public TranslationEditJPanel(Translation title, List<String> languages2, |
124 |
|
String borderTitle) { |
125 |
|
this(title, languages2); |
126 |
|
|
127 |
|
setBorder(BorderFactory.createTitledBorder(borderTitle)); |
128 |
} |
} |
129 |
|
|
130 |
private JPanel getTranslationGrid() { |
private JPanel getTranslationGrid() { |
146 |
translationGrid.add(langDesc); |
translationGrid.add(langDesc); |
147 |
translationGrid.add(langTextField); |
translationGrid.add(langTextField); |
148 |
|
|
149 |
langTextFields.add(langTextField); |
langTextFields.add(langTextField); |
150 |
} |
} |
151 |
|
|
152 |
// Lay out the panel. |
// Lay out the panel. |
167 |
return trans; |
return trans; |
168 |
} |
} |
169 |
|
|
170 |
|
/** |
171 |
|
* TODO Is never called?! |
172 |
|
*/ |
173 |
|
public void dispose() { |
174 |
|
for (TranslationJTextField f: langTextFields) { |
175 |
|
f.dispose(); |
176 |
|
} |
177 |
|
} |
178 |
|
|
179 |
public void addTranslationChangeListener(final ActionListener al) { |
public void addTranslationChangeListener(final ActionListener al) { |
180 |
final ActionListener actionListener = new ActionListener() { |
final ActionListener actionListener = new ActionListener() { |
181 |
|
|