Created
December 8, 2012 22:19
-
-
Save anonymous/4242229 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ServersStatus; | |
import javax.swing.*; | |
import java.awt.*; | |
public class ServerIndicator extends JLabel { | |
/** | |
* Constructor for this class. | |
* @param status the status of the server (true is on and false is off) | |
*/ | |
public ServerIndicator(String text,boolean status) { | |
super(text); | |
if (!status) | |
super.setBackground(SystemColor.green); | |
else | |
super.setBackground(SystemColor.red); | |
super.setOpaque(true); | |
} | |
/** | |
* Turns the server on on the UI. | |
*/ | |
public void on() { | |
super.setBackground(SystemColor.green); | |
} | |
/** | |
* Turns the server off. | |
*/ | |
public void off() { | |
super.setBackground(SystemColor.red); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment