1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.gui.action;
21
22 import java.awt.event.ActionEvent;
23
24 import org.xnap.action.AbstractXNapAction;
25 import org.xnap.gui.util.FocusManager;
26 import org.xnap.util.Preferences;
27 import org.xnap.*;
28
29 /***
30 * Provides an action that sets the focus to a specific component.
31 */
32 public class FocusAction extends AbstractXNapAction
33 {
34
35
36
37
38
39
40
41 public FocusAction()
42 {
43 putValue(AbstractXNapAction.SHORTCUT_CATEGORY, XNap.tr("Focus"));
44 }
45
46
47
48 public void actionPerformed(ActionEvent event)
49 {
50
51
52
53 if (event.getActionCommand().equals("library")) {
54 Preferences.getInstance().set("showLibraryPanel", true);
55 }
56 else if (event.getActionCommand().equals("chat")) {
57 Preferences.getInstance().set("showChatPanel", true);
58 }
59
60 FocusManager.setFocusTo(event.getActionCommand());
61 }
62
63 }