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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1785 - (show annotations) (download)
Tue Oct 7 00:07:14 2008 UTC (15 years, 5 months ago) by iliev
File size: 2732 byte(s)
* Fantasia: Implemented multiple channels panels
* Fantasia: Refactoring - all basic UI components moved to
  org.jsampler.view.fantasia.basic package

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.basic;
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.jsampler.view.fantasia.Res;
34
35 import org.jvnet.substance.api.renderers.SubstanceDefaultListCellRenderer;
36
37 /**
38 *
39 * @author Grigor Iliev
40 */
41 public class FantasiaListCellRenderer extends SubstanceDefaultListCellRenderer {
42 private FantasiaRenderer renderer = new FantasiaRenderer();
43
44 /** Creates a new instance of <code>FantasiaListCellRenderer</code> */
45 public
46 FantasiaListCellRenderer() {
47
48 }
49
50 @Override
51 public java.awt.Component
52 getListCellRendererComponent (
53 JList list, Object value, int index, boolean isSelected, boolean cellHasFocus
54 ) {
55 if(index == -1) {
56 renderer.setText(value == null ? "" : value.toString());
57 return renderer;
58 }
59 return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
60 }
61
62 static class FantasiaRenderer extends JLabel {
63 private static java.awt.Color textColor = new java.awt.Color(0xFFA300);
64 private static Insets pixmapInsets = new Insets(3, 5, 6, 5);
65
66 FantasiaRenderer() {
67 setOpaque(false);
68 setBorder(BorderFactory.createEmptyBorder(4, 5, 6, 5));
69 setForeground(new java.awt.Color(0xFFA300));
70 setBackground(new java.awt.Color(0x818181));
71 setFont(Res.fontScreen);
72 }
73
74 @Override
75 protected void
76 paintComponent(Graphics g) {
77 Graphics2D g2d = (Graphics2D)g;
78
79 g2d.setRenderingHint (
80 java.awt.RenderingHints.KEY_TEXT_ANTIALIASING,
81 java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON
82 );
83
84 PixmapPane.paintComponent(this, g, Res.gfxCbLabelBg, pixmapInsets);
85 super.paintComponent(g);
86 }
87
88 @Override
89 public java.awt.Color
90 getForeground() { return textColor; }
91
92 @Override
93 public java.awt.Font
94 getFont() { return Res.fontScreen; }
95 }
96 }

  ViewVC Help
Powered by ViewVC