import java.awt.Color;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class CRCFR extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
public CRCFR(){
this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
this.setBounds(400,200, 400,500);
this.setLayout(null);
JPanel pa=new JPanel();
pa.setLayout(null);
pa.setBounds(0,0,400,600);
pa.setBackground(Color.PINK);
this.add(pa);
JButton b1=new JButton("开始编码");
JButton b2=new JButton("发送");
JButton b3=new JButton("0");
JButton b4=new JButton("1");
b1.setBackground(Color.yellow);
b2.setBackground(Color.yellow);
b3.setBackground(Color.CYAN);
b4.setBackground(Color.CYAN);
b3.setBounds(20,250,150,50);
b4.setBounds(210,250,150,50);
b1.setBounds(20,350,150,50);
b2.setBounds(210,350,150,50);
JLabel j1=new JLabel("要编码的数据:");
JLabel j2=new JLabel("CRC-12校验码:");
JLabel j3=new JLabel("冗余码:");
JLabel j4=new JLabel("编码后的数据流:");
JTextField jtf1=new JTextField();
JTextField jtf2=new JTextField ();
JTextField jtf3=new JTextField();
JTextField jtf4=new JTextField ();
j1.setBounds(10,10,120,50);
j1.setForeground(Color.BLUE);
jtf1.setBounds(120,10,250,50);
j2.setBounds(10,70,120,50);
j2.setForeground(Color.BLUE);
jtf2.setBounds(120,70,250,50);
j3.setBounds(10,130,120,50);
j3.setForeground(Color.BLUE);
jtf3.setBounds(120,130,250,50);
j4.setBounds(10,190,120,50);
j4.setForeground(Color.BLUE);
jtf4.setBounds(120,190,250,50);
pa.add(b1);
pa.add(b2);
pa.add(b3);
pa.add(b4);
pa.add(j1);
pa.add(jtf1);
pa.add(j2);
pa.add(jtf2);
pa.add(j3);
pa.add(jtf3);
pa.add(j4);
pa.add(jtf4);
this.setVisible(true);
}
}