日期:2014-05-20  浏览次数:20581 次

在java中怎么把ascii 字符放在小框框中...也就是下面程序的每一个小框子中
在java中怎么把ascii 字符放在小框框中...也就是下面程序的每一个小框子中

下面程序运行后共有64 个框了,,,每个框子是由7*5,,也就是35 个小方格组成........怎么把Ascii字符填入其中...
Java code
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);
    }

}





------解决方案--------------------
up~~up~