1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
6 |
* This file is part of JSampler. |
7 |
* |
8 |
* JSampler is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 |
10 |
* as published by the Free Software Foundation. |
11 |
* |
12 |
* JSampler is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with JSampler; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
* MA 02111-1307 USA |
21 |
*/ |
22 |
|
23 |
package org.jsampler.view.std; |
24 |
|
25 |
import java.awt.Dimension; |
26 |
|
27 |
import javax.swing.BorderFactory; |
28 |
import javax.swing.Box; |
29 |
import javax.swing.BoxLayout; |
30 |
import javax.swing.JCheckBox; |
31 |
import javax.swing.JPanel; |
32 |
|
33 |
import org.jsampler.CC; |
34 |
import org.jsampler.JSPrefs; |
35 |
|
36 |
import static org.jsampler.view.std.StdI18n.i18n; |
37 |
import static org.jsampler.view.std.StdPrefs.*; |
38 |
|
39 |
/** |
40 |
* |
41 |
* @author Grigor Iliev |
42 |
*/ |
43 |
public class JSViewProps { |
44 |
|
45 |
/** Forbids the instantiation of this class. */ |
46 |
private JSViewProps() { } |
47 |
|
48 |
private static JSPrefs |
49 |
preferences() { return CC.getViewConfig().preferences(); } |
50 |
|
51 |
|
52 |
public static class MidiDevicesPane extends JPanel { |
53 |
private final JCheckBox checkAdditionalParams = |
54 |
new JCheckBox(i18n.getLabel("JSViewProps.checkAdditionalParams")); |
55 |
public |
56 |
MidiDevicesPane() { |
57 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
58 |
checkAdditionalParams.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
59 |
add(checkAdditionalParams); |
60 |
String s = "MidiDevice.showAdditionalParameters"; |
61 |
boolean b = preferences().getBoolProperty(s); |
62 |
checkAdditionalParams.setSelected(b); |
63 |
s = i18n.getLabel("JSViewProps.MidiDevicesPane"); |
64 |
setBorder(BorderFactory.createTitledBorder(s)); |
65 |
setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height)); |
66 |
setAlignmentX(JPanel.LEFT_ALIGNMENT); |
67 |
} |
68 |
|
69 |
public void |
70 |
apply() { |
71 |
String s = "MidiDevice.showAdditionalParameters"; |
72 |
preferences().setBoolProperty(s, checkAdditionalParams.isSelected()); |
73 |
} |
74 |
} |
75 |
|
76 |
public static class AudioDevicesPane extends JPanel { |
77 |
private final JCheckBox checkAdditionalParams = |
78 |
new JCheckBox(i18n.getLabel("JSViewProps.checkAdditionalParams")); |
79 |
public |
80 |
AudioDevicesPane() { |
81 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
82 |
checkAdditionalParams.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
83 |
add(checkAdditionalParams); |
84 |
String s = "AudioDevice.showAdditionalParameters"; |
85 |
boolean b = preferences().getBoolProperty(s); |
86 |
checkAdditionalParams.setSelected(b); |
87 |
s = i18n.getLabel("JSViewProps.AudioDevicesPane"); |
88 |
setBorder(BorderFactory.createTitledBorder(s)); |
89 |
setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height)); |
90 |
setAlignmentX(JPanel.LEFT_ALIGNMENT); |
91 |
} |
92 |
|
93 |
public void |
94 |
apply() { |
95 |
String s = "AudioDevice.showAdditionalParameters"; |
96 |
preferences().setBoolProperty(s, checkAdditionalParams.isSelected()); |
97 |
} |
98 |
} |
99 |
} |