通过applet字体显示颜色及显示的文本类容,在鼠标单击时显示文本,鼠标松开时清空文本这是颜色的代码importjava.applet.*;importjava.awt.*;publicclasstestextendsApplet{Stringtemp...
通过applet字体显示颜色 及显示的文本类容,在鼠标 单击时显示文本,鼠标松开时清空文本
这是颜色的代码
import java.applet.*;
import java.awt.*;
public class test extends Applet {
String tempString ;
Color tempColor;
Font tempFont= new Font ("����A jiushi ",Font.PLAIN,20);
public void init(){
tempString = getParameter("color");
if(tempString.equals("white"))
tempColor = new Color(255,255,255);
if(tempString.equals("blue"))
tempColor = new Color(0,0,255);
if(tempString.equals("pink"))
tempColor = new Color(255,175,175);
if(tempString.equals("black"))
tempColor = new Color(0,0,0);
if(tempString.equals("green"))
tempColor = new Color(0,255,0);
if(tempString.equals("yellow"))
tempColor = new Color(255,255,0);
}
public void paint(Graphics g ){
g.setColor(tempColor);
g.drawString(getParameter("String"), 10, 20);
}
}
加几个鼠标事件就行了
还有 html
hello world帮忙小弟搞一下 谢谢!
展开