01: /*
02: * Copyright (C) Jahia Ltd. All rights reserved.
03: *
04: * This software is published under the terms of the Jahia Open Software
05: * License version 1.1, a copy of which has been included with this
06: * distribution in the LICENSE.txt file.
07: */
08: package org.jahia.sqlprofiler.gui;
09:
10: import javax.swing.JLabel;
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 {
23:
24: private boolean statusActivated = false;
25: private Icon statusDeactivatedIcon;
26: private Icon statusActivatedIcon;
27:
28: public StatusLabel() {
29: super ();
30: java.net.URL statusOffURL = ClassLoader
31: .getSystemResource("icons/statusRed.gif");
32: statusDeactivatedIcon = new ImageIcon(statusOffURL,
33: "Status Off");
34: java.net.URL statusOnURL = ClassLoader
35: .getSystemResource("icons/statusGreen.gif");
36: statusActivatedIcon = new ImageIcon(statusOnURL, "Status On");
37: setIcon(statusDeactivatedIcon);
38: }
39:
40: public boolean isStatusActivated() {
41: return statusActivated;
42: }
43:
44: public void setStatusActivated(boolean statusActivated) {
45: this.statusActivated = statusActivated;
46: if (isStatusActivated()) {
47: setIcon(statusActivatedIcon);
48: } else {
49: setIcon(statusDeactivatedIcon);
50: }
51: }
52:
53: }
|