100 lines
2.0 KiB
Java
100 lines
2.0 KiB
Java
import java.awt.*;
|
|
//import java.applet.Applet;
|
|
import java.awt.Font;
|
|
import java.awt.Graphics;
|
|
import java.awt.Color;
|
|
import java.util.Date;
|
|
import java.awt.Frame;
|
|
|
|
public class JFoo extends java.applet.Applet implements Runnable
|
|
{
|
|
Font mFont=new Font("TimesRoman",Font.BOLD,36);
|
|
Date mDate;
|
|
Thread mThread;
|
|
Color mColor=new Color(255,0,0);
|
|
Color mBlack=new Color(192,192,192);
|
|
TextField mCtlPrincipal;
|
|
TextField mCtlInterest;
|
|
TextField mCtlTerm;
|
|
|
|
public void init()
|
|
{
|
|
add(new Label("Principal",Label.LEFT));
|
|
add(mCtlPrincipal=new TextField("$100,000.00"));
|
|
add(new Label("Interest",Label.LEFT));
|
|
add(mCtlInterest=new TextField("8.00%"));
|
|
add(new Label("Term",Label.LEFT));
|
|
add(mCtlTerm=new TextField("360"));
|
|
add(new Button("Calculate"));
|
|
repaint();
|
|
}
|
|
public void run()
|
|
{
|
|
repaint();
|
|
// repaint();
|
|
// while(true)
|
|
// {
|
|
// mDate=new Date();
|
|
// repaint();
|
|
// try{Thread.sleep(1000);}
|
|
// catch (InterruptedException e);{}
|
|
// }
|
|
}
|
|
public void start()
|
|
{
|
|
if(mThread==null){mThread=new Thread(this);mThread.start();}
|
|
}
|
|
public void stop()
|
|
{
|
|
if(null!=mThread){mThread.stop();mThread=null;}
|
|
}
|
|
public void paint(Graphics graphics)
|
|
{
|
|
setBackground(mBlack);
|
|
graphics.setFont(mFont);
|
|
graphics.setColor(mColor);
|
|
}
|
|
public boolean action(Event event,Object object)
|
|
{
|
|
if(event.id==Event.KEY_RELEASE)
|
|
{
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public void run()
|
|
{
|
|
repaint();
|
|
// repaint();
|
|
// while(true)
|
|
// {
|
|
// mDate=new Date();
|
|
// repaint();
|
|
// try{Thread.sleep(1000);}
|
|
// catch (InterruptedException e);{}
|
|
// }
|
|
}
|
|
|
|
|
|
|
|
public String makeString(int num)
|
|
{
|
|
Integer someInt=new Integer(num);
|
|
String strString=new String(someInt.toString());
|
|
String strFiller=new String();
|
|
int strLength=strString.length();
|
|
|
|
for(int i=strLength;i<3;i++)strFiller+="0";
|
|
return strFiller+strString;
|
|
}
|
|
|
|
|
|
public void drawItem(int itemIndex,Point itemPoint,Graphics graphics)
|
|
{
|
|
graphics.drawImage(mLedImages[itemIndex],itemPoint.x,itemPoint.y,this);
|
|
}
|