~veger/ganttproject/manual-import

« back to all changes in this revision

Viewing changes to ganttproject/src/net/sourceforge/ganttproject/gui/GanttCellListRenderer.java

  • Committer: Maarten Bezemer
  • Date: 2012-01-22 12:20:00 UTC
  • Revision ID: maarten.bezemer@gmail.com-20120122122000-qwyec45rjx86wi7o
Updated till 2fe683a778c3 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 GanttCellListRenderer.java  -  description
3
 
 -------------------
4
 
 begin                : jan 2003
5
 
 copyright            : (C) 2003 by Thomas Alexandre
6
 
 email                : alexthomas(at)ganttproject.org
7
 
 ***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *                                                                         *
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.                                   *
15
 
 *                                                                         *
16
 
 ***************************************************************************/
17
 
 
18
 
package net.sourceforge.ganttproject.gui;
19
 
 
20
 
import java.awt.Color;
21
 
import java.awt.Component;
22
 
 
23
 
import javax.swing.JLabel;
24
 
import javax.swing.JList;
25
 
import javax.swing.ListCellRenderer;
26
 
 
27
 
import net.sourceforge.ganttproject.language.GanttLanguage;
28
 
 
29
 
/** Class to render the background of selected cell to special blue */
30
 
public class GanttCellListRenderer extends JLabel implements ListCellRenderer {
31
 
    public GanttCellListRenderer() {
32
 
        setOpaque(true);
33
 
        applyComponentOrientation(GanttLanguage.getInstance()
34
 
                .getComponentOrientation());
35
 
    }
36
 
 
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);
43
 
        return this;
44
 
    }
45
 
 
46
 
}
 
1
/*
 
2
Copyright 2003-2012 Dmitry Barashev, GanttProject Team
 
3
 
 
4
This file is part of GanttProject, an opensource project management tool.
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
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/>.
 
18
*/