Skip to content

Instantly share code, notes, and snippets.

Created December 8, 2012 22:19
Show Gist options
  • Save anonymous/4242229 to your computer and use it in GitHub Desktop.
Save anonymous/4242229 to your computer and use it in GitHub Desktop.
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