我在appletviewer里看到的显示很是重叠的,我怎么才能让它显示清楚呢?多谢大家了

iceandfire iceandfire 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
请帮我看看这段程序,让它能在appletviewer里清晰的显示

import java.awt.*;
import java.applet.*;
import java.util.*;
import java.text.*;

class Queue3 extends Vector
{
Queue3()
{
super();
}
Queue3(int capacity)
{
super(capacity);
//System.out.println("call this()");
}
Queue3(String[] objs)
{
this(objs.length);
for (int index=0;index<objs.length;index++)
{
addElement(objs[index]);
}
}

Object dequeue()
{
Object obj=firstElement();
boolean success=removeElement(obj);
return obj;
}
}

public class Queue extends Applet
{
public void paint(Graphics g)
{
String[] s={"2002-08-09 20:00:00","2002-08-10 21:00:05","2002-08-11 22:00:32"};
Queue3 queue=new Queue3(s);
String[] s1=new String[5];
Date[] dt=new Date[5];

for (int i=0;i<s.length;i++)
{
s1[i]=(String)queue.dequeue();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
try
{
dt[i]=df.parse(s1[i]);
}
catch(ParseException e)
{
g.drawString("ParseException caught.",10,10);
}
}
for (int i=0;i<s.length;i++)
{
g.drawString("dt["+i+"]="+dt[i],10,10);
}
}
}

...全文
评论 5
收藏 已收藏
分享
返回顶部
iceandfire
Java SE 62,620 成员 307,251 内容