home *** CD-ROM | disk | FTP | other *** search
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Panel;
-
- class StatusPanel extends Panel {
- DigSim applet;
- public static final int STATUSPANEL_HEIGHT = 20;
- protected Font StatusFont;
- protected FontMetrics StatusFontMetrics;
- protected static final Color BackGroundColor;
- protected static final Color TextColor;
- protected String ActMessage = "Please wait";
- protected static final int STATUSLEDS_WIDTH = 20;
- boolean SimulationInitializeInProgress = false;
- boolean SimulationRunning = false;
- boolean StatusLedOn = false;
-
- public StatusPanel(DigSim var1) {
- this.applet = var1;
- ((Container)this).setLayout(new BorderLayout());
- this.StatusFont = new Font("TimesRoman", 0, 12);
- ((Component)this).setFont(this.StatusFont);
- this.StatusFontMetrics = ((Component)this).getFontMetrics(this.StatusFont);
- ((Component)this).repaint();
- }
-
- public boolean SimulateRunning() {
- return this.SimulationRunning | this.SimulationInitializeInProgress;
- }
-
- public Dimension preferredSize() {
- int var1 = this.applet.size().width;
- byte var2 = 20;
- return new Dimension(var1, var2);
- }
-
- public void DrawStatusLED(Graphics var1) {
- this.StatusLedOn = !this.StatusLedOn;
- int var2 = ((Component)this).size().width - 20;
- if (this.SimulationRunning && this.StatusLedOn) {
- var1.setColor(Color.green);
- } else if (this.SimulationInitializeInProgress && this.StatusLedOn) {
- var1.setColor(Color.red);
- } else {
- var1.setColor(Color.gray);
- }
-
- var1.fillOval(var2 + 3, 3, 15, 15);
- }
-
- public void paint(Graphics var1) {
- var1.setColor(BackGroundColor);
- var1.fillRect(0, 0, ((Component)this).size().width - 20, 20);
- var1.setColor(TextColor);
- var1.drawString(this.ActMessage, 2, this.StatusFontMetrics.getHeight() - 2);
- var1.setColor(Color.black);
- var1.fillRect(((Component)this).size().width - 20, 0, 20, 20);
- var1.setColor(BackGroundColor);
- var1.drawRect(((Component)this).size().width - 20, 0, 20, 20);
- this.DrawStatusLED(var1);
- }
-
- public void StatusMessage(String var1) {
- this.ActMessage = var1;
- ((Component)this).repaint();
- }
-
- static {
- BackGroundColor = Color.green;
- TextColor = Color.black;
- }
- }
-