1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.gui.prefs;
21
22 import java.awt.GridBagLayout;
23
24 import javax.swing.*;
25
26 import org.xnap.XNap;
27 import org.xnap.gui.AbstractSettingsPanel;
28 import org.xnap.gui.component.ColorPanel;
29 import org.xnap.gui.component.FontPanel;
30 import org.xnap.gui.util.GUIHelper;
31 import org.xnap.gui.util.GridBagHelper;
32
33 public class ConsoleAppearancePrefsPanel extends AbstractSettingsPanel {
34
35
36
37 private FontPanel fpConsole;
38 private ColorPanel cpConsoleBackground;
39 private ColorPanel cpConsoleForeground;
40
41
42
43 public ConsoleAppearancePrefsPanel()
44 {
45 setLayout(new GridBagLayout());
46
47 GridBagHelper.addLabel(this, XNap.tr("Font"));
48 fpConsole = new FontPanel(this, prefs.getFont("consoleFont"));
49 GridBagHelper.add(this, fpConsole);
50
51 JPanel jpConsoleColors = new JPanel(new GridBagLayout());
52 jpConsoleColors.setBorder
53 (GUIHelper.createDefaultBorder(XNap.tr("Colors")));
54 GridBagHelper.add(this, jpConsoleColors);
55
56 JLabel l = GridBagHelper.addLabel(jpConsoleColors, XNap.tr("Background"));
57 cpConsoleBackground
58 = new ColorPanel(prefs.getColor("consoleBackgroundColor"));
59 l.setLabelFor(cpConsoleBackground);
60 GridBagHelper.add(jpConsoleColors, cpConsoleBackground);
61
62 l = GridBagHelper.addLabel(jpConsoleColors, XNap.tr("Foreground"));
63 cpConsoleForeground
64 = new ColorPanel(prefs.getColor("consoleForegroundColor"));
65 l.setLabelFor(cpConsoleForeground);
66 GridBagHelper.add(jpConsoleColors, cpConsoleForeground);
67
68 GridBagHelper.addVerticalSpacer(this);
69 GUIHelper.setMnemonics(this);
70 }
71
72
73
74 public void apply()
75 {
76 prefs.set("consoleFont", fpConsole.getSelectedFont());
77 prefs.set("consoleBackgroundColor",
78 cpConsoleBackground.getSelectedColor());
79 prefs.set("consoleForegroundColor",
80 cpConsoleForeground.getSelectedColor());
81 }
82
83 public String getTitle()
84 {
85 return XNap.tr("Console");
86 }
87
88 }