/[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 1540 - (show annotations) (download)
Mon Dec 3 23:22:02 2007 UTC (16 years, 4 months ago) by iliev
File size: 3832 byte(s)
* Fantasia: by default the volume values are now shown in decibels
* Implemented support for retrieving instrument information
  from instrument files
* Some bugfixes and enhancements

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.Container;
26 import java.awt.Cursor;
27 import java.awt.Frame;
28 import java.awt.Graphics;
29 import java.awt.Graphics2D;
30 import java.awt.Insets;
31
32 import javax.swing.BorderFactory;
33 import javax.swing.JButton;
34 import javax.swing.JComboBox;
35 import javax.swing.JComponent;
36 import javax.swing.JLabel;
37 import javax.swing.JScrollBar;
38 import javax.swing.JScrollPane;
39
40 import javax.swing.plaf.basic.ComboPopup;
41
42 import org.jsampler.view.std.JSInstrumentChooser;
43
44 import org.jvnet.lafwidget.animation.FadeConfigurationManager;
45 import org.jvnet.lafwidget.animation.FadeKind;
46
47 import org.jvnet.substance.SubstanceComboBoxUI;
48 import org.jvnet.substance.combo.SubstanceComboPopup;
49 import org.jvnet.substance.SubstanceLookAndFeel;
50
51 /**
52 *
53 * @author Grigor Iliev
54 */
55 public class FantasiaUtils {
56
57 /** Forbits the instantiation of the class */
58 private
59 FantasiaUtils() { }
60
61 public static JComboBox
62 createEnhancedComboBox() {
63 return new JComboBox();
64 }
65
66 public static JSInstrumentChooser
67 createInstrumentChooser(Frame owner) {
68 return new InstrumentChooser(owner);
69 }
70
71 public static JLabel
72 createScreenLabel(String s) { return new ScreenLabel(s); }
73
74 public static JButton
75 createScreenButton(String s) { return new ScreenButton(s); }
76
77
78 private static class InstrumentChooser extends JSInstrumentChooser {
79 InstrumentChooser(Frame owner) {
80 super(owner);
81 }
82
83 protected JComboBox
84 createComboBox() { return createEnhancedComboBox(); }
85 }
86
87 private static class ScreenLabel extends JLabel {
88 ScreenLabel() { this(""); }
89
90 ScreenLabel(String s) {
91 super(s);
92 setFont(Res.fontScreen);
93 setForeground(new java.awt.Color(0xFFA300));
94 }
95
96 protected void
97 paintComponent(Graphics g) {
98 Graphics2D g2d = (Graphics2D)g;
99
100 g2d.setRenderingHint (
101 java.awt.RenderingHints.KEY_TEXT_ANTIALIASING,
102 java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON
103 );
104
105 super.paintComponent(g2d);
106 }
107 }
108
109 private static class ScreenButton extends JButton {
110 protected
111 ScreenButton(String s) {
112 super(s);
113 setContentAreaFilled(false);
114 setFocusPainted(false);
115 setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
116 setMargin(new Insets(0, 0, 0, 0));
117
118 putClientProperty (
119 SubstanceLookAndFeel.BUTTON_NO_MIN_SIZE_PROPERTY, Boolean.TRUE
120 );
121
122 putClientProperty (
123 SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY, Boolean.TRUE
124 );
125
126 putClientProperty(SubstanceLookAndFeel.FLAT_PROPERTY, Boolean.TRUE);
127
128 FadeConfigurationManager.getInstance().disallowFades(FadeKind.ROLLOVER, this);
129
130 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
131 setFont(Res.fontScreen);
132 setForeground(new java.awt.Color(0xFFA300));
133 }
134
135 protected void
136 paintComponent(Graphics g) {
137 Graphics2D g2d = (Graphics2D)g;
138
139 g2d.setRenderingHint (
140 java.awt.RenderingHints.KEY_TEXT_ANTIALIASING,
141 java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON
142 );
143
144 super.paintComponent(g2d);
145 }
146 }
147 }

  ViewVC Help
Powered by ViewVC