-
-
Save everblut/1904109 to your computer and use it in GitHub Desktop.
Luces
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
import java.awt.*; | |
import javax.swing.*; | |
import javax.swing.border.*; | |
public class Luces extends JPanel{ | |
Luz verde,roja,amarilla; | |
public Luces(){ | |
verde = new Luz(Color.GREEN); | |
roja = new Luz(Color.RED); | |
amarilla = new Luz(Color.YELLOW); | |
setLayout(new GridLayout(3,1)); | |
add(verde); | |
add(amarilla); | |
add(roja); | |
} | |
public void setLuzVerde(){ | |
verde.turnOn(true); | |
amarilla.turnOn(false); | |
roja.turnOn(false); | |
} | |
public void setLuzAmarilla(){ | |
verde.turnOn(false); | |
amarilla.turnOn(true); | |
roja.turnOn(false); | |
} | |
public void setLuzRoja(){ | |
verde.turnOn(false); | |
amarilla.turnOn(false); | |
roja.turnOn(true); | |
} | |
public void setOffAll(){ | |
verde.turnOn(false); | |
amarilla.turnOn(false); | |
roja.turnOn(false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment