1
/***************************************************************************
2
GanttCellListRenderer.java - description
5
copyright : (C) 2003 by Thomas Alexandre
6
email : alexthomas(at)ganttproject.org
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
18
package net.sourceforge.ganttproject.gui;
20
import java.awt.Color;
21
import java.awt.Component;
23
import javax.swing.JLabel;
24
import javax.swing.JList;
25
import javax.swing.ListCellRenderer;
27
import net.sourceforge.ganttproject.language.GanttLanguage;
29
/** Class to render the background of selected cell to special blue */
30
public class GanttCellListRenderer extends JLabel implements ListCellRenderer {
31
public GanttCellListRenderer() {
33
applyComponentOrientation(GanttLanguage.getInstance()
34
.getComponentOrientation());
37
public Component getListCellRendererComponent(JList list, Object value,
38
int index, boolean isSelected, boolean cellHasFocus) {
39
setText(String.valueOf(value));
40
setBackground(isSelected ? new Color((float) 0.290, (float) 0.349,
41
(float) 0.643) : Color.white);
42
setForeground(isSelected ? Color.white : Color.black);
2
Copyright 2003-2012 Dmitry Barashev, GanttProject Team
4
This file is part of GanttProject, an opensource project management tool.
6
GanttProject is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
11
GanttProject is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with GanttProject. If not, see <http://www.gnu.org/licenses/>.