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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1496 - (show annotations) (download)
Mon Nov 19 22:22:22 2007 UTC (16 years, 5 months ago) by iliev
File size: 2577 byte(s)
* Added option for turning off the custom window decoration
  (choose Edit/Preferences, then click the `View' tab)
* Added new menu item: Help/Online Tutorial
* Fantasia: first step of implementing a theme manager
* Fantasia: fixed the view of the channel's stream/voice count statistic
* some minor GUI fixes 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.Graphics;
26 import java.awt.Graphics2D;
27 import java.awt.Insets;
28
29 import javax.swing.BorderFactory;
30 import javax.swing.JLabel;
31 import javax.swing.JList;
32
33 import org.jvnet.substance.SubstanceDefaultListCellRenderer;
34
35 /**
36 *
37 * @author Grigor Iliev
38 */
39 public class FantasiaListCellRenderer extends SubstanceDefaultListCellRenderer {
40 private FantasiaRenderer renderer = new FantasiaRenderer();
41
42 /** Creates a new instance of <code>FantasiaListCellRenderer</code> */
43 public
44 FantasiaListCellRenderer() {
45
46 }
47
48 public java.awt.Component
49 getListCellRendererComponent (
50 JList list, Object value, int index, boolean isSelected, boolean cellHasFocus
51 ) {
52 if(index == -1) {
53 renderer.setText(value == null ? "" : value.toString());
54 return renderer;
55 }
56 return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
57 }
58
59 static class FantasiaRenderer extends JLabel {
60 private static java.awt.Color textColor = new java.awt.Color(0xFFA300);
61 private static Insets pixmapInsets = new Insets(3, 5, 6, 5);
62
63 FantasiaRenderer() {
64 setOpaque(false);
65 setBorder(BorderFactory.createEmptyBorder(4, 3, 6, 5));
66 setForeground(new java.awt.Color(0xFFA300));
67 setFont(Res.fontScreen);
68 }
69
70 protected void
71 paintComponent(Graphics g) {
72 Graphics2D g2d = (Graphics2D)g;
73
74 g2d.setRenderingHint (
75 java.awt.RenderingHints.KEY_TEXT_ANTIALIASING,
76 java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON
77 );
78
79 PixmapPane.paintComponent(this, g, Res.gfxCbLabelBg, pixmapInsets);
80 super.paintComponent(g);
81 }
82
83 public java.awt.Color
84 getForeground() { return textColor; }
85
86 public java.awt.Font
87 getFont() { return Res.fontScreen; }
88 }
89 }

  ViewVC Help
Powered by ViewVC