1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.commons.gui.util;
21
22 import java.awt.Component;
23 import java.awt.Frame;
24 import java.awt.Window;
25 import java.lang.reflect.Method;
26 import org.xnap.commons.i18n.LocaleChangeEvent;
27 import org.xnap.commons.i18n.LocaleChangeListener;
28
29 /***
30 *
31 * @author Steffen Pingel
32 */
33 public class LabelUpdater implements LocaleChangeListener {
34
35 public void localeChanged(LocaleChangeEvent event)
36 {
37 Frame[] frames = Frame.getFrames();
38 for (Frame frame : frames) {
39 Window[] windows = frame.getOwnedWindows();
40 for (Window window : windows) {
41 handleWindow(window);
42 }
43 }
44 }
45
46 protected void handleWindow(Window window)
47 {
48 for (ComponentIterator it = new ComponentIterator(window); it.hasNext();) {
49 Component c = it.next();
50
51 Method method;
52 try {
53 method = c.getClass().getMethod("updateLabels");
54 method.invoke(c);
55 }
56 catch (Exception e) { }
57 }
58 }
59
60 }
61