import java.applet.Applet;
import java.awt.*;
import java.awt.geom.Rectangle2D;import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;public class TestApplet extends Applet {
public void init()
{
this.setSize(500,500);
this.setLocation(200,200);
init("1111111000010011001111111100000001101110010000000110111110100101101011111011010000001110000000000101101011101100100010111010110101110100111101011101011010111010011001001110101000000001110001100000000000010110000111001010101010110000000011011000011100010110100110001001110110100100100010000100111000011111101001110011100011001110011101110110001110000110101111010010100111101010101000001001001100100110101010101000100100110100000000000001101101000000001111111000110111101110101000000101010001010111010111111010110010011011101010000101001101001000000101111010101110100110111110111101010101101011000000011110101001010110001111111",25);
}
public void init(String s1,int in)
{
add(new DrawPanel(s1,in));
}
}class DrawPanel extends JPanel {
String dimenValue; int dimenNum; Rectangle2D r; public DrawPanel() {
} public DrawPanel(String x, int y) {
this.dimenValue = x;
this.dimenNum = y;

Button b=new Button("提交");
Button b1=new Button("撤消");
this.add(b);
this.add(b1);
Label l1=new Label();
Label l2=new Label();
Label l3=new Label();
Label l4=new Label();
Label l5=new Label();
Label l6=new Label();
Label l7=new Label();
Label l8=new Label();
Label l9=new Label();
Label l10=new Label();
Label l11=new Label();
this.add(l1);
this.add(l2);
this.add(l3);
this.add(l4);
this.add(l5);
this.add(l6);
this.add(l7);
this.add(l8);
this.add(l9);
this.add(l10);
this.add(l11);

}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;

int x=10,y=10;
Rectangle2D r;
String s;

//System.out.println(dimenValue);
//System.out.println(dimenNum);
for(int i=0;i<dimenNum;i++)
{
if(dimenValue.length()>dimenNum)
{
   s=dimenValue.substring(0,dimenNum);
   dimenValue=dimenValue.substring(dimenNum);
   for(int k=0;k<s.length();k++)
   {
   String printColor=s.substring(k,k+1);
   if(printColor.equals("0"))
   {
   g2.setColor(Color.WHITE);
   }
   else
   {
   g2.setColor(Color.BLACK);
   }
   r=new Rectangle2D.Double(x, y, 2, 2);
   x=x+2;
   g2.fill(r);
   }
   x=10;
   y=y+2;
}
else
{
   s=dimenValue;
   for(int l=0;l<s.length();l++)
   {
   String printColor=s.substring(l,l+1);
   if(printColor.equals("0"))
   {
   g2.setColor(Color.WHITE);
   }
   else
   {
   g2.setColor(Color.BLACK);
   }
   r=new Rectangle2D.Double(x, y, 2, 2);
   x=x+2;
   g2.fill(r);
   }
}
}
}
}