java 画的图形显示不全 是怎么回事。。如下代码片段,只能显示一个缺一条边的矩形
一publicvoidpaint(Graphicsg){super.paint(g);drawSort(g);}二publicvoiddrawSort(Graphicsg...
一
public void paint(Graphics g){
super.paint(g);
drawSort(g);
}
二
public void drawSort(Graphics g){
for(int i = 0; i < n; i++) {if(max<s[i]) max=s[i];}
for(int i=0;i<n;i++){DrawNode(g,s[i],i);}
三
public void DrawNode(Graphics g, int num,int i){
int height = 30 + (num / max)*340;
int x = 100+(/*(600-n*40)/n*/40+40)*i;
Color c = g.getColor();
g.setColor(Color.black);
g.drawRect(x, 500 - height, 40, height);
g.drawString(String.valueOf(num), x + 15, 500 - 24);
}
四
public void run() {
try {
kuaipai(0,n-1);
Thread.sleep(200);
}
catch (InterruptedException e) {
e.printStackTrace();
}
} 展开
public void paint(Graphics g){
super.paint(g);
drawSort(g);
}
二
public void drawSort(Graphics g){
for(int i = 0; i < n; i++) {if(max<s[i]) max=s[i];}
for(int i=0;i<n;i++){DrawNode(g,s[i],i);}
三
public void DrawNode(Graphics g, int num,int i){
int height = 30 + (num / max)*340;
int x = 100+(/*(600-n*40)/n*/40+40)*i;
Color c = g.getColor();
g.setColor(Color.black);
g.drawRect(x, 500 - height, 40, height);
g.drawString(String.valueOf(num), x + 15, 500 - 24);
}
四
public void run() {
try {
kuaipai(0,n-1);
Thread.sleep(200);
}
catch (InterruptedException e) {
e.printStackTrace();
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |