First Commit
This commit is contained in:
commit
e5198fabcb
|
@ -0,0 +1 @@
|
|||
Two old Java programs that need to be modernized. Eventually.
|
|
@ -0,0 +1,219 @@
|
|||
class DominoClock
|
||||
|
||||
constructor: ({@container}) ->
|
||||
@container.append('<canvas class="canvas_itself"></canvas>')
|
||||
@canvas = $('canvas', @container).get(0)
|
||||
@canvas.width = @width = @container.width()
|
||||
@canvas.height = @hight = @container.height()
|
||||
@ctx = @canvas.getContext('2d')
|
||||
|
||||
if @height > 3 * @width
|
||||
@square_d = @width
|
||||
else
|
||||
@square_d = @height / 3
|
||||
|
||||
|
||||
tock: (element, time) ->
|
||||
dot: (x, y) ->
|
||||
@ctx.context.beginPath();
|
||||
@ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
|
||||
|
||||
@ctx.clearRect(0, 0, @height, @width)
|
||||
|
||||
if time in [1, 5, 8, 9, 11]
|
||||
dot startx + dotrad, starty + dotrad
|
||||
|
||||
if time in [2, 5, 6, 10, 11]
|
||||
dot startx + squard - (2 * dotrad), starty + dotrad
|
||||
|
||||
if time in [3, 6, 7, 9, 11]
|
||||
dot startx + squard - (2 * dotrad), starty + squared - (2 * dotrad)
|
||||
|
||||
if time in [4, 7, 8, 10, 11]
|
||||
dot startx + dotrad, starty + squared - (2 * dotrad)
|
||||
|
||||
paint: ->
|
||||
d = new Date()
|
||||
hour = d.getHours() + 1
|
||||
hour = if hour > 12 then hour - 12 else hour
|
||||
min = d.getMinutes()
|
||||
sec = d.getSeconds()
|
||||
|
||||
@tock(@elements.hour, @startx, @starty, hour)
|
||||
@tock(@elements.mins, @startx, @starty + @square_d, (min / 5))
|
||||
@tock(@elements.secs, @startx, @starty + (2 * @square_d), (sec / 5))
|
||||
|
||||
start: ->
|
||||
@running = true
|
||||
@run()
|
||||
|
||||
|
||||
stop: ->
|
||||
clearTimeout @waiting
|
||||
@running = false
|
||||
|
||||
run: =>
|
||||
if @running
|
||||
@paint()
|
||||
@waiting = setTimeout(120, @run)
|
||||
|
||||
|
||||
|
||||
$ ->
|
||||
clock = new DominoClock($('container'))
|
||||
|
||||
|
||||
public class DominoClock extends Applet implements Runnable {
|
||||
|
||||
int StartX, StartY, SquareD, DotRad;
|
||||
Color bgColor, dominoColor, dotColor;
|
||||
Thread clock = null;
|
||||
String background;
|
||||
|
||||
public void init() {
|
||||
|
||||
try {
|
||||
background = getParameter( "bgcolor" );
|
||||
} catch (NullPointerException e) {};
|
||||
|
||||
if (( background == null ) ||
|
||||
( background.charAt(0) != '#' ) ||
|
||||
( background.length() != 7 )) {
|
||||
Integer rgbValue = new Integer(0);
|
||||
bgColor = new Color(rgbValue.intValue());
|
||||
} else {
|
||||
Integer rgbValue = new Integer(0);
|
||||
rgbValue = Integer.valueOf( background.substring(1,7), 16 );
|
||||
bgColor = new Color(rgbValue.intValue());
|
||||
}
|
||||
|
||||
try {
|
||||
background = getParameter( "dominocolor" );
|
||||
} catch (NullPointerException e) {};
|
||||
if (( background == null ) ||
|
||||
( background.charAt(0) != '#' ) ||
|
||||
( background.length() != 7 )) {
|
||||
Integer rgbValue = new Integer(14331680);
|
||||
dominoColor = new Color(rgbValue.intValue());
|
||||
} else {
|
||||
Integer rgbValue = new Integer(14331680);
|
||||
rgbValue = Integer.valueOf( background.substring(1,7), 16 );
|
||||
dominoColor = new Color(rgbValue.intValue());
|
||||
}
|
||||
|
||||
try {
|
||||
background = getParameter( "dotcolor" );
|
||||
} catch (NullPointerException e) {};
|
||||
if (( background == null ) ||
|
||||
( background.charAt(0) != '#' ) ||
|
||||
( background.length() != 7 )) {
|
||||
Integer rgbValue = new Integer(3100495);
|
||||
dotColor = new Color(rgbValue.intValue());
|
||||
} else {
|
||||
Integer rgbValue = new Integer(3100495);
|
||||
rgbValue = Integer.valueOf( background.substring(1,7), 16 );
|
||||
dotColor = new Color(rgbValue.intValue());
|
||||
}
|
||||
|
||||
Dimension D = size();
|
||||
|
||||
if (D.height > (3 * D.width)) {
|
||||
SquareD = D.width;
|
||||
StartX = 0;
|
||||
StartY = 0; // (D.height / 3) - SquareD;
|
||||
}
|
||||
else {
|
||||
SquareD = (D.height / 3);
|
||||
StartY = 0;
|
||||
StartX = 0; //.width - (SquareD / 3);
|
||||
}
|
||||
|
||||
DotRad = (int) (Math.sqrt(2 * SquareD * SquareD) / 6);
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
|
||||
int Hour, Min, Sec;
|
||||
Date D = new Date();
|
||||
|
||||
Hour = D.getHours();
|
||||
if (Hour > 12) Hour = Hour - 12;
|
||||
Min = D.getMinutes();
|
||||
Sec = D.getSeconds();
|
||||
|
||||
Tock(StartX, StartY, Hour, g);
|
||||
Tock(StartX, StartY + SquareD, (Min / 5), g);
|
||||
Tock(StartX, StartY + (2 * SquareD), (Sec / 5), g);
|
||||
}
|
||||
|
||||
public void update(Graphics g) {
|
||||
paint(g); // Overridden to prevent flicker.
|
||||
}
|
||||
|
||||
public void start() {
|
||||
clock = new Thread(this);
|
||||
clock.start();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
clock.stop();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while(true) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
catch(InterruptedException e) {}
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Tock: (int time) ->
|
||||
|
||||
@ctx.clearRect(0, 0, @height, @width)
|
||||
|
||||
dot: (x, y) ->
|
||||
@ctx.context.beginPath();
|
||||
@ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
|
||||
|
||||
context.fillStyle = "#8ED6FF";
|
||||
context.fill();
|
||||
context.lineWidth = 5;
|
||||
context.strokeStyle = "black";
|
||||
context.stroke();
|
||||
|
||||
g.fillRect(StartX, StartY, SquareD, SquareD);
|
||||
g.setColor(dotColor);
|
||||
|
||||
if ((time == 1) || (time == 5) || (time == 8) || (time == 9) || (time == 11))
|
||||
g.fillOval(StartX + DotRad, StartY + DotRad, DotRad, DotRad);
|
||||
|
||||
if ((time == 2) || (time == 5) || (time == 6) || (time == 10) || (time == 11))
|
||||
g.fillOval(StartX + SquareD - (2 * DotRad), StartY + DotRad, DotRad, DotRad);
|
||||
|
||||
if ((time == 3) || (time == 6) || (time == 7) || (time == 9) || (time == 11))
|
||||
g.fillOval(StartX + SquareD - (2 * DotRad), StartY + SquareD - (2 * DotRad), DotRad, DotRad);
|
||||
|
||||
if ((time == 4) || (time == 7) || (time == 8) || (time == 10) || (time == 11))
|
||||
g.fillOval(StartX + DotRad, StartY + SquareD - (2 * DotRad), DotRad, DotRad);
|
||||
|
||||
g.drawLine(StartX, StartY + SquareD - 1, StartX + SquareD, StartY + SquareD - 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String args[]) {
|
||||
Frame f1 = new Frame("Domino Clock");
|
||||
DominoClock s1 = new DominoClock();
|
||||
|
||||
f1.add("Center", s1);
|
||||
f1.resize(300, 300);
|
||||
f1.show();
|
||||
|
||||
s1.init();
|
||||
s1.start();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
//Draw a clock based upon the Domino display.
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.util.*;
|
||||
import java.lang.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class DominoClock extends Applet implements Runnable {
|
||||
|
||||
int StartX, StartY, SquareD, DotRad;
|
||||
Color bgColor, dominoColor, dotColor;
|
||||
Thread clock = null;
|
||||
String background;
|
||||
|
||||
public void init() {
|
||||
|
||||
try {
|
||||
background = getParameter( "bgcolor" );
|
||||
} catch (NullPointerException e) {};
|
||||
|
||||
if (( background == null ) ||
|
||||
( background.charAt(0) != '#' ) ||
|
||||
( background.length() != 7 )) {
|
||||
Integer rgbValue = new Integer(0);
|
||||
bgColor = new Color(rgbValue.intValue());
|
||||
} else {
|
||||
Integer rgbValue = new Integer(0);
|
||||
rgbValue = Integer.valueOf( background.substring(1,7), 16 );
|
||||
bgColor = new Color(rgbValue.intValue());
|
||||
}
|
||||
|
||||
try {
|
||||
background = getParameter( "dominocolor" );
|
||||
} catch (NullPointerException e) {};
|
||||
if (( background == null ) ||
|
||||
( background.charAt(0) != '#' ) ||
|
||||
( background.length() != 7 )) {
|
||||
Integer rgbValue = new Integer(14331680);
|
||||
dominoColor = new Color(rgbValue.intValue());
|
||||
} else {
|
||||
Integer rgbValue = new Integer(14331680);
|
||||
rgbValue = Integer.valueOf( background.substring(1,7), 16 );
|
||||
dominoColor = new Color(rgbValue.intValue());
|
||||
}
|
||||
|
||||
try {
|
||||
background = getParameter( "dotcolor" );
|
||||
} catch (NullPointerException e) {};
|
||||
if (( background == null ) ||
|
||||
( background.charAt(0) != '#' ) ||
|
||||
( background.length() != 7 )) {
|
||||
Integer rgbValue = new Integer(3100495);
|
||||
dotColor = new Color(rgbValue.intValue());
|
||||
} else {
|
||||
Integer rgbValue = new Integer(3100495);
|
||||
rgbValue = Integer.valueOf( background.substring(1,7), 16 );
|
||||
dotColor = new Color(rgbValue.intValue());
|
||||
}
|
||||
|
||||
Dimension D = size();
|
||||
|
||||
if (D.height > (3 * D.width)) {
|
||||
SquareD = D.width;
|
||||
StartX = 0;
|
||||
StartY = 0; // (D.height / 3) - SquareD;
|
||||
}
|
||||
else {
|
||||
SquareD = (D.height / 3);
|
||||
StartY = 0;
|
||||
StartX = 0; //.width - (SquareD / 3);
|
||||
}
|
||||
|
||||
DotRad = (int) (Math.sqrt(2 * SquareD * SquareD) / 6);
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
|
||||
int Hour, Min, Sec;
|
||||
Date D = new Date();
|
||||
|
||||
Hour = D.getHours();
|
||||
if (Hour > 12) Hour = Hour - 12;
|
||||
Min = D.getMinutes();
|
||||
Sec = D.getSeconds();
|
||||
|
||||
Tock(StartX, StartY, Hour, g);
|
||||
Tock(StartX, StartY + SquareD, (Min / 5), g);
|
||||
Tock(StartX, StartY + (2 * SquareD), (Sec / 5), g);
|
||||
}
|
||||
|
||||
public void update(Graphics g) {
|
||||
paint(g); // Overridden to prevent flicker.
|
||||
}
|
||||
|
||||
public void start() {
|
||||
clock = new Thread(this);
|
||||
clock.start();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
clock.stop();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while(true) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
catch(InterruptedException e) {}
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private void Tock(int StartX, int StartY, int time, Graphics g) {
|
||||
|
||||
g.setColor(dominoColor);
|
||||
g.fillRect(StartX, StartY, SquareD, SquareD);
|
||||
g.setColor(dotColor);
|
||||
|
||||
if ((time == 1) || (time == 5) || (time == 8) || (time == 9) || (time == 11))
|
||||
g.fillOval(StartX + DotRad, StartY + DotRad, DotRad, DotRad);
|
||||
|
||||
if ((time == 2) || (time == 5) || (time == 6) || (time == 10) || (time == 11))
|
||||
g.fillOval(StartX + SquareD - (2 * DotRad), StartY + DotRad, DotRad, DotRad);
|
||||
|
||||
if ((time == 3) || (time == 6) || (time == 7) || (time == 9) || (time == 11))
|
||||
g.fillOval(StartX + SquareD - (2 * DotRad), StartY + SquareD - (2 * DotRad), DotRad, DotRad);
|
||||
|
||||
if ((time == 4) || (time == 7) || (time == 8) || (time == 10) || (time == 11))
|
||||
g.fillOval(StartX + DotRad, StartY + SquareD - (2 * DotRad), DotRad, DotRad);
|
||||
|
||||
g.drawLine(StartX, StartY + SquareD - 1, StartX + SquareD, StartY + SquareD - 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String args[]) {
|
||||
Frame f1 = new Frame("Domino Clock");
|
||||
DominoClock s1 = new DominoClock();
|
||||
|
||||
f1.add("Center", s1);
|
||||
f1.resize(300, 300);
|
||||
f1.show();
|
||||
|
||||
s1.init();
|
||||
s1.start();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
|
||||
// Jad home page: http://www.geocities.com/kpdus/jad.html
|
||||
// Decompiler options: packimports(3)
|
||||
// Source File Name: PendorDate.java
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.awt.*;
|
||||
import java.util.Date;
|
||||
|
||||
public class PendorDate extends Applet
|
||||
implements Runnable
|
||||
{
|
||||
|
||||
public void init()
|
||||
{
|
||||
String s = getParameter("font");
|
||||
if(s == null)
|
||||
s = "Times";
|
||||
String s1 = getParameter("size");
|
||||
if(s1 == null)
|
||||
s1 = "18";
|
||||
int i = Integer.valueOf(s1).intValue();
|
||||
String s2 = getParameter("bgcolor");
|
||||
if(s2 != null && s2.charAt(0) == '#' && s2.length() == 7)
|
||||
{
|
||||
Integer integer = new Integer(0);
|
||||
integer = Integer.valueOf(s2.substring(1, 7), 16);
|
||||
bgColor = new Color(integer.intValue());
|
||||
bgColorSet = Boolean.TRUE;
|
||||
}
|
||||
String s3 = getParameter("fgcolor");
|
||||
if(s3 == null || s3.charAt(0) != '#' || s3.length() != 7)
|
||||
{
|
||||
fgColor = Color.black;
|
||||
} else
|
||||
{
|
||||
Integer integer1 = new Integer(0);
|
||||
integer1 = Integer.valueOf(s3.substring(1, 7), 16);
|
||||
fgColor = new Color(integer1.intValue());
|
||||
}
|
||||
font = new Font(s, 0, i);
|
||||
}
|
||||
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
Date date = new Date();
|
||||
String s = new String();
|
||||
int i = aiMonths[date.getMonth()] + date.getDate();
|
||||
if(date.getMonth() > 2 && date.getYear() % 4 == 0 && date.getYear() % 2000 != 0)
|
||||
i++;
|
||||
i = (i * 24 + date.getHours()) - 16;
|
||||
int j = date.getYear() + 16;
|
||||
int k = i / 30;
|
||||
int l = i % 30;
|
||||
int i1 = (int)((double)(date.getSeconds() + date.getMinutes() * 60) / 2.25D);
|
||||
int j1 = i1 / 40;
|
||||
i1 %= 40;
|
||||
Dimension dimension = size();
|
||||
g.setFont(font);
|
||||
if(bgColorSet == Boolean.TRUE)
|
||||
{
|
||||
g.setColor(bgColor);
|
||||
g.fillRect(0, 0, dimension.width, dimension.height);
|
||||
}
|
||||
g.setColor(fgColor);
|
||||
s = "The time on Pendor is " + String.valueOf(l) + ":";
|
||||
if(j1 < 10)
|
||||
s = s + "0";
|
||||
s = s + String.valueOf(j1) + ":";
|
||||
if(i1 < 10)
|
||||
s = s + "0";
|
||||
s = s + String.valueOf(i1);
|
||||
int k1;
|
||||
for(k1 = 0; k1 <= 17; k1++)
|
||||
if(aiPMonths[k1] >= k)
|
||||
break;
|
||||
|
||||
s = s + " on " + asWNames[(k1 - 1) % 6] + ", " + asMNames[k1 - 1] + " " + String.valueOf(k - aiPMonths[k1 - 1]) + ", 0" + String.valueOf(j);
|
||||
g.drawString(s, 2, font.getSize());
|
||||
}
|
||||
|
||||
public void start()
|
||||
{
|
||||
clock = new Thread(this);
|
||||
clock.start();
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
clock.stop();
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(1250L);
|
||||
}
|
||||
catch(InterruptedException _ex) { }
|
||||
repaint();
|
||||
} while(true);
|
||||
}
|
||||
|
||||
public PendorDate()
|
||||
{
|
||||
bgColorSet = Boolean.FALSE;
|
||||
dateDisplay = Boolean.TRUE;
|
||||
}
|
||||
|
||||
Thread clock;
|
||||
Font font;
|
||||
Color bgColor;
|
||||
Color fgColor;
|
||||
Boolean bgColorSet;
|
||||
Boolean dateDisplay;
|
||||
private static short aiMonths[] = {
|
||||
0, 31, 59, 90, 120, 151, 181, 212, 243, 273,
|
||||
304, 334
|
||||
};
|
||||
private static short aiPMonths[] = {
|
||||
0, 1, 25, 49, 73, 97, 121, 145, 146, 147,
|
||||
171, 195, 211, 243, 267, 291, 292
|
||||
};
|
||||
private static String asMNames[] = {
|
||||
"Yestar", "Narrin", "Nenim", "Sulim", "Virta", "Lothess", "Narnya", "Attendes", "Loende", "Cerim",
|
||||
"Urim", "Yavar", "Narquel", "Hiss", "Ring", "Mettare"
|
||||
};
|
||||
private static String asWNames[] = {
|
||||
"Seren", "Anar", "Noren", "Aldea", "Erwer", "Elenya"
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
//
|
||||
// Copyright (c) 1995 Elf M. Sternberg.
|
||||
//
|
||||
// PendorClock.java v1.0 - Displays the time on Pendor in an applet
|
||||
// by Elf Sternberg (elf@halcyon.com)
|
||||
//
|
||||
// Based in part on code by Chris Southern (southern@wsrn.com)
|
||||
//
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.lang.*;
|
||||
import java.applet.*;
|
||||
|
||||
public class PendorDate extends Applet implements Runnable {
|
||||
Thread clock; // applet thread
|
||||
Font font; // display font
|
||||
|
||||
Color bgColor; // applet bgcolor
|
||||
Color fgColor; // applet fgcolor
|
||||
|
||||
Boolean bgColorSet = Boolean.FALSE; // bgColor set?
|
||||
Boolean dateDisplay = Boolean.TRUE;
|
||||
|
||||
public void init() {
|
||||
|
||||
String FontName = getParameter("font");
|
||||
if ( FontName == null ) FontName = "Times";
|
||||
|
||||
String FontSize = getParameter("size");
|
||||
if ( FontSize == null) FontSize = "18";
|
||||
|
||||
int size = Integer.valueOf(FontSize).intValue();
|
||||
|
||||
String background = getParameter( "bgcolor" );
|
||||
if (( background == null ) ||
|
||||
( background.charAt(0) != '#' ) ||
|
||||
( background.length() != 7 )) {
|
||||
} else {
|
||||
Integer rgbValue = new Integer(0);
|
||||
rgbValue = Integer.valueOf( background.substring(1,7), 16 );
|
||||
bgColor = new Color(rgbValue.intValue());
|
||||
bgColorSet = Boolean.TRUE;
|
||||
}
|
||||
|
||||
String foreground = getParameter( "fgcolor" );
|
||||
if (( foreground == null ) ||
|
||||
( foreground.charAt(0) != '#' ) ||
|
||||
( foreground.length() != 7 )) {
|
||||
fgColor = Color.black;
|
||||
} else {
|
||||
Integer rgbValue = new Integer(0);
|
||||
rgbValue = Integer.valueOf( foreground.substring(1,7), 16 );
|
||||
fgColor = new Color(rgbValue.intValue());
|
||||
}
|
||||
|
||||
// Setup Applet
|
||||
font = new Font(FontName, Font.PLAIN, size );
|
||||
}
|
||||
|
||||
private static short aiMonths[] = {
|
||||
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
|
||||
|
||||
private static short aiPMonths[] = {
|
||||
0, 1, 25, 49, 73, 97, 121, 145, 146, 147, 171, 195, 211, 243, 267, 291, 292 };
|
||||
|
||||
private static String asMNames[] = {
|
||||
"Yestar", "Narrin", "Nenim", "Sulim", "Virta", "Lothess",
|
||||
"Narnya", "Attendes", "Loende", "Cerim", "Urim", "Yavar",
|
||||
"Narquel", "Hiss", "Ring", "Mettare" };
|
||||
|
||||
private static String asWNames[] = {
|
||||
"Seren", "Anar", "Noren", "Aldea", "Erwer", "Elenya" };
|
||||
|
||||
// paint - display the clock, and process am & pm stuff
|
||||
|
||||
public void paint( Graphics g ) {
|
||||
Date d = new Date();
|
||||
String strOut = new String();
|
||||
|
||||
int iDay, iYer, iYday, iHour, iSec, iMin, i;
|
||||
|
||||
iDay = aiMonths[d.getMonth()] + d.getDate();
|
||||
|
||||
|
||||
if (d.getMonth() > 2 )
|
||||
if (d.getYear() % 4 == 0)
|
||||
if (d.getYear() % 2000 != 0)
|
||||
iDay++;
|
||||
|
||||
// Leap Year/GMT patch. Ick.
|
||||
iDay = (iDay * 24) + d.getHours() - 16;
|
||||
iYer = d.getYear() + 16;
|
||||
|
||||
iYday = iDay / 30;
|
||||
iHour = iDay % 30;
|
||||
|
||||
iSec = (int) ((d.getSeconds() + (d.getMinutes() * 60)) / 2.25);
|
||||
|
||||
iMin = iSec / 40;
|
||||
iSec = iSec % 40;
|
||||
|
||||
|
||||
Dimension appletSize = size();
|
||||
|
||||
g.setFont( font );
|
||||
|
||||
if ( bgColorSet == Boolean.TRUE ) {
|
||||
g.setColor( bgColor );
|
||||
g.fillRect( 0, 0, appletSize.width, appletSize.height );
|
||||
}
|
||||
g.setColor( fgColor );
|
||||
|
||||
strOut = "The time on Pendor is " + String.valueOf(iHour) + ":";
|
||||
|
||||
if (iMin < 10)
|
||||
strOut = strOut + "0";
|
||||
|
||||
strOut = strOut + String.valueOf(iMin) + ":";
|
||||
|
||||
if (iSec < 10)
|
||||
strOut = strOut + "0";
|
||||
|
||||
strOut = strOut + String.valueOf(iSec);
|
||||
|
||||
for(i = 0; i <= 17; i++)
|
||||
if (aiPMonths[i] >= iYday)
|
||||
break;
|
||||
|
||||
strOut = strOut + " on " + asWNames[(i - 1) % 6] + ", " + asMNames[(i-1)] + " " +
|
||||
String.valueOf(iYday - aiPMonths[i - 1]) + ", 0" + String.valueOf(iYer);
|
||||
|
||||
g.drawString(strOut, 2, font.getSize() );
|
||||
}
|
||||
|
||||
// start - start the applet
|
||||
public void start() {
|
||||
clock = new Thread( this );
|
||||
clock.start();
|
||||
}
|
||||
|
||||
// stop - stop the applet
|
||||
public void stop() {
|
||||
clock.stop();
|
||||
}
|
||||
|
||||
// run - main
|
||||
public void run() {
|
||||
while (true) {
|
||||
try {
|
||||
Thread.sleep(1250);
|
||||
}
|
||||
catch (InterruptedException e) {}
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue