KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > sqlprofiler > gui > StatusLabel


1 /*
2  * Copyright (C) Jahia Ltd. All rights reserved.
3  *
4  * This software is published under the terms of the Jahia Open Software
5  * License version 1.1, a copy of which has been included with this
6  * distribution in the LICENSE.txt file.
7  */

8 package org.jahia.sqlprofiler.gui;
9
10 import javax.swing.JLabel JavaDoc;
11 import javax.swing.*;
12
13 /**
14  * <p>Title: SQL Profiler</p>
15  * <p>Description: </p>
16  * <p>Copyright: Copyright (c) 2003</p>
17  * <p>Company: Jahia Ltd</p>
18  * @author Serge Huber
19  * @version 1.0
20  */

21
22 public class StatusLabel extends JLabel JavaDoc {
23
24     private boolean statusActivated = false;
25     private Icon statusDeactivatedIcon;
26     private Icon statusActivatedIcon;
27
28     public StatusLabel() {
29         super();
30         java.net.URL JavaDoc statusOffURL = ClassLoader.getSystemResource("icons/statusRed.gif");
31         statusDeactivatedIcon = new ImageIcon(statusOffURL, "Status Off");
32         java.net.URL JavaDoc statusOnURL = ClassLoader.getSystemResource("icons/statusGreen.gif");
33         statusActivatedIcon = new ImageIcon(statusOnURL, "Status On");
34         setIcon(statusDeactivatedIcon);
35     }
36
37     public boolean isStatusActivated() {
38         return statusActivated;
39     }
40
41     public void setStatusActivated(boolean statusActivated) {
42         this.statusActivated = statusActivated;
43         if (isStatusActivated()) {
44             setIcon(statusActivatedIcon);
45         } else {
46             setIcon(statusDeactivatedIcon);
47         }
48     }
49
50 }
Popular Tags