01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: DefaultFocusSetter.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.swing;
09:
10: import javax.swing.JComponent;
11: import javax.swing.SwingUtilities;
12:
13: public class DefaultFocusSetter extends Thread {
14: private JComponent mComponentToFocus = null;
15:
16: public DefaultFocusSetter(DefaultFocused object) {
17: mComponentToFocus = object.getDefaultFocus();
18: SwingUtilities.invokeLater(this );
19: }
20:
21: public void run() {
22: if (null != mComponentToFocus) {
23: mComponentToFocus.requestFocus();
24: }
25: }
26: }
|