1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005-2010 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.basic; |
24 |
|
25 |
import javax.swing.Icon; |
26 |
import javax.swing.JButton; |
27 |
import javax.swing.JComboBox; |
28 |
import javax.swing.plaf.basic.BasicComboBoxUI; |
29 |
|
30 |
import javax.swing.plaf.basic.ComboPopup; |
31 |
|
32 |
import org.jsampler.view.fantasia.Res; |
33 |
|
34 |
import org.pushingpixels.substance.internal.utils.combo.SubstanceComboPopup; |
35 |
|
36 |
/** |
37 |
* |
38 |
* @author Grigor Iliev |
39 |
*/ |
40 |
public class FantasiaComboBoxUI extends BasicComboBoxUI { |
41 |
private JComboBox combo; |
42 |
|
43 |
/** Creates a new instance of <code>FantasiaComboBoxUI</code> */ |
44 |
public |
45 |
FantasiaComboBoxUI(JComboBox combo) { |
46 |
super(); |
47 |
this.combo = combo; |
48 |
currentValuePane.setBackground(combo.getBackground()); |
49 |
} |
50 |
|
51 |
@Override |
52 |
public JButton |
53 |
createArrowButton() { |
54 |
JButton btn = new ArrowButton(); |
55 |
return btn; |
56 |
} |
57 |
|
58 |
@Override |
59 |
protected ComboPopup |
60 |
createPopup() { |
61 |
ComboPopup cp = new SubstanceComboPopup(combo); |
62 |
cp.getList().setFont(cp.getList().getFont().deriveFont(10.0f)); |
63 |
|
64 |
return cp; |
65 |
} |
66 |
|
67 |
public class ArrowButton extends PixmapButton { |
68 |
ArrowButton() { |
69 |
super(Res.gfxCbArrow); |
70 |
super.setIcon(Res.gfxCbArrow); |
71 |
super.setRolloverIcon(Res.gfxCbArrowRO); |
72 |
super.setDisabledIcon(Res.gfxCbArrowDisabled); |
73 |
setBackground(new java.awt.Color(0x818181)); |
74 |
} |
75 |
|
76 |
@Override |
77 |
public void |
78 |
setIcon(Icon icon) { } |
79 |
|
80 |
@Override |
81 |
public void |
82 |
setRolloverIcon(Icon icon) { } |
83 |
|
84 |
@Override |
85 |
public void |
86 |
setDisabledIcon(Icon icon) { } |
87 |
} |
88 |
} |