-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.uconn.edu/lwm14001/Student-Ad…
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# Student-Admin-Redesign | ||
Changes Changes Changes | ||
This is a redesign of student admin by group 2 | ||
|
||
Wonder if this will work. Hmmmmmmmm. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package example_applet; | ||
import java.awt.BorderLayout; | ||
import java.awt.Color; | ||
import java.awt.Container; | ||
import java.awt.HeadlessException; | ||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
|
||
import javax.swing.JApplet; | ||
import javax.swing.JButton; | ||
|
||
/* | ||
* Created on Oct 6, 2004 | ||
* | ||
* @author Steve Tanimoto | ||
*/ | ||
@SuppressWarnings("serial") | ||
public class TrafficLight extends JApplet implements ActionListener { | ||
int phase = 0; | ||
Container c; | ||
/** | ||
* @throws java.awt.HeadlessException | ||
*/ | ||
public TrafficLight() throws HeadlessException { | ||
JButton jb = new JButton("Change!"); | ||
c = this.getContentPane(); | ||
c.setLayout(new BorderLayout()); | ||
c.add(jb, BorderLayout.SOUTH); | ||
jb.addActionListener(this); | ||
c.setBackground(Color.green); | ||
} | ||
public void actionPerformed(ActionEvent e) { | ||
phase = (phase + 1) % 3; | ||
if (phase == 0) { | ||
c.setBackground(Color.green); | ||
} | ||
else if (phase == 1) { | ||
c.setBackground(Color.yellow); | ||
} | ||
else if (phase == 2) { | ||
c.setBackground(Color.red); | ||
} | ||
} | ||
} |