home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 2.2 KB | 88 lines |
- // TodayPanel.java
- // 21.03.96
- //
- // events that are happening today
-
- package cybcerone.main;
-
- import java.awt.Rectangle;
- import java.awt.Image;
- import java.awt.Graphics;
-
- import cybcerone.utils.Date;
- import cybcerone.utils.Appletlike;
- import cybcerone.utils.Manif;
- import cybcerone.utils.TextPanel;
- import cybcerone.utils.Fonts;
-
- /**
- * Events that are happening today.
- */
- class TodayPanel extends HappeningPanel {
- private static final Rectangle placement = new Rectangle (0, 583, 1024, 85);
-
- private static final String id = "TodayPanel";
- private static String statusText = "Today's events";
- private static final String bgFile = imagePath + "fond_aujour.gif";
-
- private Image ledsOn;
-
- private TodayEventPanel infoPanel;
- private TextPanel titlePanel;
-
- public TodayPanel (Image ledsOn, Appletlike app) {
- super (id, statusText, app);
- reshape (placement);
-
- if (!Date.realDate ()) {
- statusText += " (demonstration)";
- setStatusText (statusText);
- }
-
- setBackground (bgFile, 0);
- this.ledsOn = ledsOn;
-
- add (infoPanel = new TodayEventPanel (id, statusText, this));
- infoPanel.setColor (gray);
- infoPanel.setFont (Fonts.smallFont);
-
- add (titlePanel = new TextPanel (id, statusText, app));
- titlePanel.reshape (scale (210), scale (11), scale (809), scale (22));
- titlePanel.setFont (Fonts.smallFont);
- titlePanel.setColor (gray);
- hide ();
- }
-
- public void update (Object updateVal) {
- if (updateVal instanceof Manif)
- update ((Manif)updateVal);
- else
- super.update (updateVal);
- }
-
- protected void update (Manif theEvent) {
- titlePanel.setText (theEvent.getTime () + " " + theEvent.getTitle ());
- titlePanel.setNext (theEvent);
- }
-
- public void update () {
- super.update ();
- infoPanel.update (getTheEvents ());
- }
-
- protected Date pastDate (Date now) {
- return (new Date (now.getYear (), now.getMonth (), now.getDate ()));
- }
-
- protected Date futureDate (Date now) {
- return (new Date (now.getYear (), now.getMonth (), now.getDate () + 1));
- }
-
- public void paint (Graphics g) {
- super.paint (g);
- if (ledsOn != null)
- g.drawImage (ledsOn, 0, scale (37), this);
- }
-
- }
-