/[svn]/jsampler/trunk/src/org/jsampler/view/fantasia/FantasiaUtils.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/view/fantasia/FantasiaUtils.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1752 - (show annotations) (download)
Mon Aug 11 22:51:24 2008 UTC (15 years, 8 months ago) by iliev
File size: 4320 byte(s)
* Added toolbar to the Database Instrument Chooser dialog
* Instrument Chooser and Database Instrument Chooser dialogs
  are now resizable
* Fantasia: Added toolbar to the Right-Side Pane's Instruments Database

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2008 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.Container;
26 import java.awt.Cursor;
27 import java.awt.Dialog;
28 import java.awt.Frame;
29 import java.awt.Graphics;
30 import java.awt.Graphics2D;
31 import java.awt.Insets;
32
33 import javax.swing.Action;
34 import javax.swing.BorderFactory;
35 import javax.swing.JButton;
36 import javax.swing.JComboBox;
37 import javax.swing.JComponent;
38 import javax.swing.JLabel;
39 import javax.swing.JScrollBar;
40 import javax.swing.JScrollPane;
41
42 import javax.swing.plaf.basic.BasicButtonUI;
43 import javax.swing.plaf.basic.BasicLabelUI;
44 import javax.swing.plaf.basic.ComboPopup;
45
46 import org.jsampler.view.InstrumentsDbTreeModel;
47
48 import org.jsampler.view.std.JSDbInstrumentChooser;
49 import org.jsampler.view.std.JSInstrumentChooser;
50 import org.jsampler.view.std.JSInstrumentsDbTree;
51
52 import org.jvnet.lafwidget.animation.FadeConfigurationManager;
53 import org.jvnet.lafwidget.animation.FadeKind;
54
55 import org.jvnet.substance.SubstanceComboBoxUI;
56 import org.jvnet.substance.SubstanceLookAndFeel;
57
58 /**
59 *
60 * @author Grigor Iliev
61 */
62 public class FantasiaUtils {
63
64 /** Forbits the instantiation of the class */
65 private
66 FantasiaUtils() { }
67
68 public static JComboBox
69 createEnhancedComboBox() {
70 return new JComboBox();
71 }
72
73 public static JSInstrumentChooser
74 createInstrumentChooser(Frame owner) {
75 return new InstrumentChooser(owner);
76 }
77
78 public static JLabel
79 createScreenLabel(String s) { return new ScreenLabel(s); }
80
81 public static JButton
82 createScreenButton(String s) { return new ScreenButton(s); }
83
84
85 private static class InstrumentChooser extends JSInstrumentChooser {
86 InstrumentChooser(Frame owner) {
87 super(owner);
88 }
89
90 protected JComboBox
91 createComboBox() { return createEnhancedComboBox(); }
92
93 protected JSDbInstrumentChooser
94 createDbInstrumentChooser(Dialog owner) {
95 return new DbInstrumentChooser(owner);
96 }
97 }
98
99 private static class DbInstrumentChooser extends JSDbInstrumentChooser {
100 DbInstrumentChooser(Dialog owner) {
101 super(owner);
102 }
103
104 protected JButton
105 createToolbarButton(Action a) { return new ToolbarButton(a); }
106
107 protected JSInstrumentsDbTree
108 createInstrumentsDbTree(InstrumentsDbTreeModel m) {
109 return new FantasiaInstrumentsDbTree(m);
110 }
111 }
112
113 private static class ScreenLabel extends JLabel {
114 ScreenLabel() { this(""); }
115
116 ScreenLabel(String s) {
117 super(s);
118 setFont(Res.fontScreen);
119 setForeground(new java.awt.Color(0xFFA300));
120 }
121
122 protected void
123 paintComponent(Graphics g) {
124 Graphics2D g2d = (Graphics2D)g;
125
126 g2d.setRenderingHint (
127 java.awt.RenderingHints.KEY_TEXT_ANTIALIASING,
128 java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON
129 );
130
131 super.paintComponent(g2d);
132 }
133
134 public void
135 updateUI() { setUI(new BasicLabelUI()); }
136 }
137
138 private static class ScreenButton extends JButton {
139 protected
140 ScreenButton(String s) {
141 super(s);
142 setContentAreaFilled(false);
143 setFocusPainted(false);
144 setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
145 setMargin(new Insets(0, 0, 0, 0));
146
147 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
148 setFont(Res.fontScreen);
149 setForeground(new java.awt.Color(0xFFA300));
150 }
151
152 protected void
153 paintComponent(Graphics g) {
154 Graphics2D g2d = (Graphics2D)g;
155
156 g2d.setRenderingHint (
157 java.awt.RenderingHints.KEY_TEXT_ANTIALIASING,
158 java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON
159 );
160
161 super.paintComponent(g2d);
162 }
163
164 public void
165 updateUI() { setUI(new BasicButtonUI()); }
166 }
167 }

  ViewVC Help
Powered by ViewVC