附录
1.applet代码:
package lqh.rmb.applicate;
import java.awt.*;
import java.awt.event.*;
import lqh.rmb.*;
public class rmb extends applet {
private boolean isstandalone = false;
private rmbconversion rmb=new rmbconversion();
private string var0 = "";
private string re_rmb="";
private string wigth ="0";
private string back_color;
private string fore_color;
public string getparameter(string key, string def) {
return isstandalone ? system.getproperty(key, def) :
(getparameter(key) != null ? getparameter(key) : def);
}
public void paint(graphics g) {
if(wigth.equals("0")){
wigth = "560";
}
int i= integer.parseint(wigth);
if(checknum(var0)){
if(var0.endswith(".")){
var0 = var0.substring(0,var0.length()-1);
}
re_rmb= rmb.rmb(var0);
}else{
re_rmb="输入错误:"+var0;
}
int middel =(i - re_rmb.length()*12)/2;
this.setbackground(new color(getcolor(back_color)[0], getcolor(back_color)[1], getcolor(back_color)[2]));
this.setforeground(new color(getcolor(fore_color)[0], getcolor(fore_color)[1], getcolor(fore_color)[2]));
g.drawstring(re_rmb,middel,20);
}
public void init() {
try {
back_color = this.getparameter("rgb_back", "241247251");
}catch(exception e) {e.printstacktrace();}
try {
fore_color = this.getparameter("rgb_fore", "25500");
}catch(exception e) {e.printstacktrace();}
try {
wigth = this.getparameter("wigth", "0");
}catch(exception e) {e.printstacktrace();}
try {
jbinit();
}catch(exception e) { e.printstacktrace(); }
}
private void jbinit() throws exception {
this.setbackground(new color(getcolor(back_color)[0], getcolor(back_color)[1], getcolor(back_color)[2]));
}
public void setrmb(string rmb_temp){
var0 = rmb_temp;
}
public string getrmb(string rmb_temp){
if(checknum(rmb_temp)){
if(rmb_temp.endswith(".")){
rmb_temp = rmb_temp.substring(0,rmb_temp.length()-1);
}
re_rmb= rmb.rmb(rmb_temp);
}else{
re_rmb="输入错误:"+rmb_temp;
}
return re_rmb;
}
public boolean checknum(string str){
string numchar="0123456789.";
boolean breakboolean = false;
for(int i=0;i<str.length();i++){
if(numchar.indexof(str.substring(i,i+1))<0){
breakboolean =true;
}
if(breakboolean) break;
}
if(breakboolean){
return false;
}else{
if(str.startswith(".")){
return false;
}else{
return true;
}
}
}
public string[][] getparameterinfo() {
string[][] pinfo =
{
{"rgb_back", "string", ""},
{"rgb_fore", "string", ""},
{"wigth", "string", ""},
};
return pinfo;
}
private int[] getcolor(string rgb){
int[] rgb_return = new int[3];
int index =0,nextindex=0,len=0;
while((index =rgb.indexof("",nextindex))>-1){
rgb_return[len]=getint(rgb.substring(nextindex,index));
nextindex=index+1;
len++;
}
rgb_return[len]=getint(rgb.substring(nextindex));
return rgb_return;
}
private int getint(string str){
try{
return integer.parseint(str);
}catch(exception e){
return 0;
}
}
}
2.java包,欢迎索取lqhboy@163.com
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器