1 | package org.greenstone.gatherer.gui.tree;
|
---|
2 | /**
|
---|
3 | *#########################################################################
|
---|
4 | *
|
---|
5 | * A component of the Gatherer application, part of the Greenstone digital
|
---|
6 | * library suite from the New Zealand Digital Library Project at the
|
---|
7 | * University of Waikato, New Zealand.
|
---|
8 | *
|
---|
9 | * <BR><BR>
|
---|
10 | *
|
---|
11 | * Author: John Thompson, Greenstone Digital Library, University of Waikato
|
---|
12 | *
|
---|
13 | * <BR><BR>
|
---|
14 | *
|
---|
15 | * Copyright (C) 1999 New Zealand Digital Library Project
|
---|
16 | *
|
---|
17 | * <BR><BR>
|
---|
18 | *
|
---|
19 | * This program is free software; you can redistribute it and/or modify
|
---|
20 | * it under the terms of the GNU General Public License as published by
|
---|
21 | * the Free Software Foundation; either version 2 of the License, or
|
---|
22 | * (at your option) any later version.
|
---|
23 | *
|
---|
24 | * <BR><BR>
|
---|
25 | *
|
---|
26 | * This program is distributed in the hope that it will be useful,
|
---|
27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
29 | * GNU General Public License for more details.
|
---|
30 | *
|
---|
31 | * <BR><BR>
|
---|
32 | *
|
---|
33 | * You should have received a copy of the GNU General Public License
|
---|
34 | * along with this program; if not, write to the Free Software
|
---|
35 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
36 | *########################################################################
|
---|
37 | */
|
---|
38 | import java.awt.Color;
|
---|
39 | import java.awt.Component;
|
---|
40 | import javax.swing.JTree;
|
---|
41 | import javax.swing.tree.DefaultTreeCellRenderer;
|
---|
42 |
|
---|
43 | public class DragTreeCellRenderer
|
---|
44 | extends DefaultTreeCellRenderer {
|
---|
45 |
|
---|
46 | private boolean in_focus = false;
|
---|
47 | private Color selection_background;
|
---|
48 | private Color selection_foreground;
|
---|
49 |
|
---|
50 | public DragTreeCellRenderer() {
|
---|
51 | super();
|
---|
52 | selection_background = getBackgroundSelectionColor();
|
---|
53 | selection_foreground = getTextSelectionColor();
|
---|
54 | }
|
---|
55 |
|
---|
56 | public void gainFocus() {
|
---|
57 | setBackgroundSelectionColor(selection_background);
|
---|
58 | setTextSelectionColor(selection_foreground);
|
---|
59 | }
|
---|
60 |
|
---|
61 | public void loseFocus() {
|
---|
62 | setBackgroundSelectionColor(Color.lightGray);
|
---|
63 | setTextSelectionColor(Color.black);
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|