Initial
This commit is contained in:
124
java/HOTLINK/TMP/HOTLIN~1.JAV
Normal file
124
java/HOTLINK/TMP/HOTLIN~1.JAV
Normal file
@@ -0,0 +1,124 @@
|
||||
import java.awt.*;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Color;
|
||||
import java.util.Date;
|
||||
import java.awt.Frame;
|
||||
import java.awt.image.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
public class HotLink extends java.applet.Applet implements Runnable
|
||||
{
|
||||
private Thread mThread;
|
||||
private final int smImageCount=12;
|
||||
private Image[] mLedImages=new Image[smImageCount];
|
||||
private String mStrParam;
|
||||
private String mServerString;
|
||||
private String mURLString;
|
||||
private Button mButton;
|
||||
|
||||
public HotLink()
|
||||
{
|
||||
}
|
||||
public void init()
|
||||
{
|
||||
LocalServer localServer;
|
||||
localServer=new LocalServer();
|
||||
try{mStrParam=localServer.getServerIP(getCodeBase());}
|
||||
catch(Exception exception){mStrParam=new String("255.255.255.255");}
|
||||
mURLString=new String("http://");
|
||||
mURLString+=mStrParam;
|
||||
mButton=new Button("Ganymede");
|
||||
add(mButton);
|
||||
mLedImages[0]=getImage(getCodeBase(),"image/zero.gif");
|
||||
mLedImages[1]=getImage(getCodeBase(),"image/one.gif");
|
||||
mLedImages[2]=getImage(getCodeBase(),"image/two.gif");
|
||||
mLedImages[3]=getImage(getCodeBase(),"image/three.gif");
|
||||
mLedImages[4]=getImage(getCodeBase(),"image/four.gif");
|
||||
mLedImages[5]=getImage(getCodeBase(),"image/five.gif");
|
||||
mLedImages[6]=getImage(getCodeBase(),"image/six.gif");
|
||||
mLedImages[7]=getImage(getCodeBase(),"image/seven.gif");
|
||||
mLedImages[8]=getImage(getCodeBase(),"image/eight.gif");
|
||||
mLedImages[9]=getImage(getCodeBase(),"image/nine.gif");
|
||||
mLedImages[10]=getImage(getCodeBase(),"image/dash.gif");
|
||||
mLedImages[11]=getImage(getCodeBase(),"image/blank.gif");
|
||||
MediaTracker mediaTracker=new MediaTracker(this);
|
||||
for(int imageIndex=0;imageIndex<smImageCount;imageIndex++)mediaTracker.addImage(mLedImages[imageIndex],imageIndex);
|
||||
try(mediaTracker.waitForAll());
|
||||
catch(InterruptedException ie){;}
|
||||
repaint();
|
||||
}
|
||||
public void run()
|
||||
{
|
||||
repaint();
|
||||
}
|
||||
public void start()
|
||||
{
|
||||
if(mThread==null){mThread=new Thread(this);mThread.start();}
|
||||
}
|
||||
public void stop()
|
||||
{
|
||||
if(null!=mThread){mThread.stop();mThread=null;}
|
||||
}
|
||||
public void update(Graphics graphics)
|
||||
{
|
||||
paint(graphics);
|
||||
}
|
||||
public void paint(Graphics graphics)
|
||||
{
|
||||
setBackground(new Color(0x2A,0x7F,0xAA));
|
||||
drawLEDString(mStrParam,graphics);
|
||||
}
|
||||
public void drawLEDString(String strLED,Graphics graphics)
|
||||
{
|
||||
int strLength=strLED.length();
|
||||
int imageWidth;
|
||||
int imageHeight;
|
||||
Point ptLoc;
|
||||
|
||||
ptLoc=new Point(4,4);
|
||||
imageWidth=mLedImages[0].getWidth(this);
|
||||
imageHeight=mLedImages[0].getHeight(this);
|
||||
for(int strIndex=0;strIndex<strLength;strIndex++)
|
||||
{
|
||||
char strChar=strLED.charAt(strIndex);
|
||||
|
||||
if('0'==strChar)graphics.drawImage(mLedImages[0],ptLoc.x,ptLoc.y,this);
|
||||
else if('1'==strChar)graphics.drawImage(mLedImages[1],ptLoc.x,ptLoc.y,this);
|
||||
else if('2'==strChar)graphics.drawImage(mLedImages[2],ptLoc.x,ptLoc.y,this);
|
||||
else if('3'==strChar)graphics.drawImage(mLedImages[3],ptLoc.x,ptLoc.y,this);
|
||||
else if('4'==strChar)graphics.drawImage(mLedImages[4],ptLoc.x,ptLoc.y,this);
|
||||
else if('5'==strChar)graphics.drawImage(mLedImages[5],ptLoc.x,ptLoc.y,this);
|
||||
else if('6'==strChar)graphics.drawImage(mLedImages[6],ptLoc.x,ptLoc.y,this);
|
||||
else if('7'==strChar)graphics.drawImage(mLedImages[7],ptLoc.x,ptLoc.y,this);
|
||||
else if('8'==strChar)graphics.drawImage(mLedImages[8],ptLoc.x,ptLoc.y,this);
|
||||
else if('9'==strChar)graphics.drawImage(mLedImages[9],ptLoc.x,ptLoc.y,this);
|
||||
else if('.'==strChar)graphics.drawImage(mLedImages[10],ptLoc.x,ptLoc.y,this);
|
||||
else graphics.drawImage(mLedImages[11],ptLoc.x,ptLoc.y,this);
|
||||
ptLoc.x+=imageWidth;
|
||||
}
|
||||
graphics.setColor(new Color(48,64,0));
|
||||
graphics.drawLine(3,3,ptLoc.x,3);
|
||||
graphics.drawLine(3,3,3,imageHeight+4);
|
||||
graphics.setColor(new Color(175,192,224));
|
||||
graphics.drawLine(3,imageHeight+4,ptLoc.x,imageHeight+4);
|
||||
graphics.drawLine(ptLoc.x,3,ptLoc.x,imageHeight+4);
|
||||
graphics.setColor(new Color(96,143,208));
|
||||
graphics.drawRect(2,2,(ptLoc.x+1)-2,imageHeight+3);
|
||||
graphics.setColor(new Color(175,192,224));
|
||||
graphics.drawLine(1,1,ptLoc.x+2,1);
|
||||
}
|
||||
public boolean action(Event event,Object object)
|
||||
{
|
||||
if(null!=mButton&&mButton==event.target)
|
||||
{
|
||||
URL localLink;
|
||||
try{localLink=new URL(mURLString);}
|
||||
catch(MalformedURLException exception){return true;}
|
||||
getAppletContext().showDocument(localLink);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
75
java/HOTLINK/TMP/INFILE~1.JAV
Normal file
75
java/HOTLINK/TMP/INFILE~1.JAV
Normal file
@@ -0,0 +1,75 @@
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
|
||||
class InFile
|
||||
{
|
||||
boolean mIsOkay;
|
||||
private URL mInFile;
|
||||
private URLConnection mConnection;
|
||||
private DataInputStream mInData;
|
||||
private String mStrLine;
|
||||
|
||||
public InFile()
|
||||
{
|
||||
mIsOkay=false;
|
||||
}
|
||||
public InFile(URL resBase,String strHostPathFileName)throws Exception
|
||||
{
|
||||
mIsOkay=false;
|
||||
open(resBase,strHostPathFileName);
|
||||
}
|
||||
public InFile(String strHostPathFileName)throws Exception
|
||||
{
|
||||
mIsOkay=false;
|
||||
open(strHostPathFileName);
|
||||
}
|
||||
public InFile(String resBase,String strHostPathFileName)throws Exception
|
||||
{
|
||||
mIsOkay=false;
|
||||
open(resBase,strHostPathFileName);
|
||||
}
|
||||
public void open(URL resBase,String strHostPathFileName)throws Exception
|
||||
{
|
||||
close();
|
||||
try{mInFile=new URL(resBase,strHostPathFileName);}
|
||||
catch(MalformedURLException exception){throw new Exception();}
|
||||
try{mConnection=mInFile.openConnection();}
|
||||
catch(Exception exception){throw new Exception();}
|
||||
try{mInData=new DataInputStream(mConnection.getInputStream());}
|
||||
catch(Exception exception){throw new Exception();}
|
||||
mIsOkay=true;
|
||||
}
|
||||
public void open(String resBase,String strHostPathFileName)throws Exception
|
||||
{
|
||||
open(resBase+strHostPathFileName);
|
||||
}
|
||||
public void open(String strHostPathFileName)throws Exception
|
||||
{
|
||||
close();
|
||||
try{mInFile=new URL(strHostPathFileName);}
|
||||
catch(MalformedURLException exception){throw new Exception();}
|
||||
try{mConnection=mInFile.openConnection();}
|
||||
catch(IOException ioException){throw new Exception();}
|
||||
try{mInData=new DataInputStream(mConnection.getInputStream());}
|
||||
catch(Exception exception){throw new Exception();}
|
||||
mIsOkay=true;
|
||||
}
|
||||
public void close()
|
||||
{
|
||||
if(!isOkay())return;
|
||||
try{mInData.close();}
|
||||
catch(Exception exception){;}
|
||||
mIsOkay=false;
|
||||
}
|
||||
public String readLine()throws Exception
|
||||
{
|
||||
if(!isOkay())throw new Exception();
|
||||
try{mStrLine=new String(mInData.readLine());}
|
||||
catch(IOException ioException){throw new Exception();}
|
||||
return mStrLine;
|
||||
}
|
||||
public boolean isOkay()
|
||||
{
|
||||
return mIsOkay;
|
||||
}
|
||||
};
|
||||
42
java/HOTLINK/TMP/LOCALS~1.JAV
Normal file
42
java/HOTLINK/TMP/LOCALS~1.JAV
Normal file
@@ -0,0 +1,42 @@
|
||||
import java.net.*;
|
||||
|
||||
class LocalServer
|
||||
{
|
||||
private final String mPathIPFileName=new String("ip");
|
||||
private final String mStrID=new String("[IP]");
|
||||
private final int mMinLength=mStrID.length();
|
||||
|
||||
public LocalServer()
|
||||
{
|
||||
}
|
||||
public String getServerIP(String strHostPathFileName)throws Exception
|
||||
{
|
||||
return getServerIP(new InFile(strHostPathFileName,mPathIPFileName));
|
||||
}
|
||||
public String getServerIP(URL resBase)throws Exception
|
||||
{
|
||||
return getServerIP(new InFile(resBase,mPathIPFileName));
|
||||
}
|
||||
private String getServerIP(InFile inFile)throws Exception
|
||||
{
|
||||
String strHost;
|
||||
String strLine;
|
||||
int strLen;
|
||||
|
||||
strLine=new String();
|
||||
strHost=new String();
|
||||
while(true)
|
||||
{
|
||||
try{strLine=inFile.readLine();}
|
||||
catch(Exception exception){return strHost;}
|
||||
strLen=strLine.length();
|
||||
if(strLen<mMinLength)continue;
|
||||
if(0==strLine.substring(0,mMinLength).compareTo(mStrID))
|
||||
{
|
||||
strHost=strLine.substring(mMinLength+1,strLen-1);
|
||||
return strHost;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user