import java.awt.*;
import java.applet.*;
class tp extends Component {
String index;
void DrawIndex(String idx, Graphics g) {
g.setColor(Color.red);
g.drawString(idx, 10, 50);
}
public tp(String idx){
index = idx;
}
public tp() {
index = "10";
}
public void paint(Graphics g) {
super.paint(g);
DrawIndex(index, g);
}
public void update(Graphics g) {
paint(g);
}
}
public class Temp extends Applet {
tp tp1 = new tp("ok");
public void init()
{
this.setLayout(new GridLayout(1,1));
add(tp1);
}
}
直接从awt继承下来的 tp 组件,要让它有 tooptips 的功能,应该怎样实现?哪位同志实现过这样的功能,请赐教!!
import java.applet.*;
class tp extends Component {
String index;
void DrawIndex(String idx, Graphics g) {
g.setColor(Color.red);
g.drawString(idx, 10, 50);
}
public tp(String idx){
index = idx;
}
public tp() {
index = "10";
}
public void paint(Graphics g) {
super.paint(g);
DrawIndex(index, g);
}
public void update(Graphics g) {
paint(g);
}
}
public class Temp extends Applet {
tp tp1 = new tp("ok");
public void init()
{
this.setLayout(new GridLayout(1,1));
add(tp1);
}
}
直接从awt继承下来的 tp 组件,要让它有 tooptips 的功能,应该怎样实现?哪位同志实现过这样的功能,请赐教!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货