在java中怎么把ascii 字符放在小框框中...也就是下面程序的每一个小框子中下面程序运行后共有64 个框了,,,每个框子是由7*5,,也就是35 个小方格组成........怎么把Ascii字符填入其中...
import javax.swing.*;
import java.awt.*;public class linke extends JFrame{
int xx=0;
int yy=0;
String a="";
public linke()
{
this.setAlwaysOnTop(true);
this.getContentPane().setBackground(Color.BLACK);
this.setUndecorated(true);
this.setSize(476,156);
this.setLocation(50,50);
this.setVisible(true);
}
public void paint(Graphics g){
super.paint(g);
xx=0;
yy=0;
g.setColor(Color.WHITE);
for(int c=1;c<32;c++){ //控制行的输出
xx=0;
for(int i=1;i<97;i++){ //控制列的输出
if(i%6 == 0 && i!=0){
g.setColor(Color.BLACK);
}else{
g.setColor(Color.WHITE);
}
if(c%8==0){
g.setColor(Color.BLACK);
}
g.fill3DRect(xx, yy, 5, 5, true);
xx=xx+5;
}
yy=yy+5;
} }
public static void main(String args[]){
linke l = new linke();
l.setBackground(Color.RED);
}}
import javax.swing.*;
import java.awt.*;public class linke extends JFrame{
int xx=0;
int yy=0;
String a="";
public linke()
{
this.setAlwaysOnTop(true);
this.getContentPane().setBackground(Color.BLACK);
this.setUndecorated(true);
this.setSize(476,156);
this.setLocation(50,50);
this.setVisible(true);
}
public void paint(Graphics g){
super.paint(g);
xx=0;
yy=0;
g.setColor(Color.WHITE);
for(int c=1;c<32;c++){ //控制行的输出
xx=0;
for(int i=1;i<97;i++){ //控制列的输出
if(i%6 == 0 && i!=0){
g.setColor(Color.BLACK);
}else{
g.setColor(Color.WHITE);
}
if(c%8==0){
g.setColor(Color.BLACK);
}
g.fill3DRect(xx, yy, 5, 5, true);
xx=xx+5;
}
yy=yy+5;
} }
public static void main(String args[]){
linke l = new linke();
l.setBackground(Color.RED);
}}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货