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.fantasia; |
24 |
|
25 |
import java.awt.BorderLayout; |
26 |
import java.awt.Dimension; |
27 |
import java.awt.Graphics; |
28 |
import java.awt.Insets; |
29 |
|
30 |
import java.beans.PropertyChangeEvent; |
31 |
import java.beans.PropertyChangeListener; |
32 |
|
33 |
import javax.swing.BorderFactory; |
34 |
import javax.swing.JPanel; |
35 |
|
36 |
import org.jvnet.substance.SubstanceLookAndFeel; |
37 |
import org.jvnet.substance.button.ClassicButtonShaper; |
38 |
import org.jvnet.substance.utils.SubstanceConstants.FocusKind; |
39 |
|
40 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
41 |
import static org.jsampler.view.fantasia.FantasiaPrefs.*; |
42 |
|
43 |
/** |
44 |
* |
45 |
* @author Grigor Iliev |
46 |
*/ |
47 |
public class DevicesPane extends JPanel { |
48 |
private final TaskPaneContainer taskPaneContainer = new TaskPaneContainer(); |
49 |
private final TaskPane midiDevicesTaskPane = new TaskPane(); |
50 |
private final TaskPane audioDevicesTaskPane = new TaskPane(); |
51 |
|
52 |
/** Creates a new instance of <code>DevicesPane</code> */ |
53 |
public |
54 |
DevicesPane() { |
55 |
setOpaque(false); |
56 |
setLayout(new BorderLayout()); |
57 |
midiDevicesTaskPane.setTitle(i18n.getLabel("DevicesPane.midiDevicesTaskPane")); |
58 |
midiDevicesTaskPane.setAnimated(preferences().getBoolProperty(ANIMATED)); |
59 |
|
60 |
preferences().addPropertyChangeListener(ANIMATED, new PropertyChangeListener() { |
61 |
public void |
62 |
propertyChange(PropertyChangeEvent e) { |
63 |
boolean b = preferences().getBoolProperty(ANIMATED); |
64 |
midiDevicesTaskPane.setAnimated(b); |
65 |
} |
66 |
}); |
67 |
|
68 |
audioDevicesTaskPane.setTitle(i18n.getLabel("DevicesPane.audioDevicesTaskPane")); |
69 |
audioDevicesTaskPane.setAnimated(preferences().getBoolProperty(ANIMATED)); |
70 |
|
71 |
preferences().addPropertyChangeListener(ANIMATED, new PropertyChangeListener() { |
72 |
public void |
73 |
propertyChange(PropertyChangeEvent e) { |
74 |
boolean b = preferences().getBoolProperty(ANIMATED); |
75 |
audioDevicesTaskPane.setAnimated(b); |
76 |
} |
77 |
}); |
78 |
|
79 |
midiDevicesTaskPane.putClientProperty ( |
80 |
SubstanceLookAndFeel.FOCUS_KIND, FocusKind.NONE |
81 |
); |
82 |
|
83 |
taskPaneContainer.putClientProperty ( |
84 |
SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new ClassicButtonShaper() |
85 |
); |
86 |
|
87 |
taskPaneContainer.add(midiDevicesTaskPane); |
88 |
taskPaneContainer.add(audioDevicesTaskPane); |
89 |
taskPaneContainer.setBorder(BorderFactory.createEmptyBorder()); |
90 |
add(taskPaneContainer); |
91 |
|
92 |
midiDevicesTaskPane.add(new MidiDevicesPane()); |
93 |
audioDevicesTaskPane.add(new AudioDevicesPane()); |
94 |
|
95 |
taskPaneContainer.setOpaque(false); |
96 |
} |
97 |
} |