java工程编程错误帮忙修改

package com.zong.demo;


import java.awt.Color;

import java.awt.Container;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;


import javax.swing.JButton;

import javax.swing.JCheckBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextField;


import com.setandget.Renshu;


@SuppressWarnings("serial")

public class RenshuDemo extends JFrame {


    public RenshuDemo() {/* JFrame frame */

        // super(frame, "������ѯ", true);

        setBounds(450, 250, 550, 500);

        setDefaultCloseOperation(EXIT_ON_CLOSE);

        final Renshu renshu1 = new Renshu();

        

        // final Renshu renshu3 = new Renshu();

        // final Renshu renshu4 = new Renshu();

        // final Renshu renshu5 = new Renshu();

        // final Renshu renshu6 = new Renshu();

        Container con = getContentPane();

        con.setBackground(Color.PINK);

        setResizable(false);

        setLayout(null);


        final JCheckBox box1 = new JCheckBox();

        final JTextField field1_1 = new JTextField();

        final JTextField field1_2 = new JTextField();

        field1_1.setBounds(30, 5, 20, 20);

        JLabel jLabel1 = new JLabel(":");

        jLabel1.setBounds(53, 5, 20, 20);

        field1_2.setBounds(60, 5, 20, 20);

        field1_1.requestFocus();

        box1.setBounds(5, 5, 20, 20);

        con.add(box1);

        con.add(field1_1);

        con.add(jLabel1);

        con.add(field1_2);


        final Renshu renshu2 = new Renshu();

        final JCheckBox box2 = new JCheckBox();

        final JTextField field2_1 = new JTextField();

        final JTextField field2_2 = new JTextField();

        field2_1.setBounds(30, 40, 20, 20);

        JLabel jLabel2 = new JLabel(":");

        jLabel2.setBounds(53, 40, 20, 20);

        field2_2.setBounds(60, 40, 20, 20);

        box2.setBounds(5, 40, 20, 20);

        con.add(box2);

        con.add(field2_1);

        con.add(jLabel2);

        con.add(field2_2);


        final JCheckBox box3 = new JCheckBox();

        final JTextField field3_1 = new JTextField();

        final JTextField field3_2 = new JTextField();

        field3_1.setBounds(30, 75, 20, 20);

        JLabel jLabel3 = new JLabel(":");

        jLabel3.setBounds(53, 75, 20, 20);

        field3_2.setBounds(60, 75, 20, 20);

        box3.setBounds(5, 75, 20, 20);

        con.add(box3);

        con.add(field3_1);

        con.add(jLabel3);

        con.add(field3_2);


        final JCheckBox box4 = new JCheckBox();

        final JTextField field4_1 = new JTextField();

        final JTextField field4_2 = new JTextField();

        field4_1.setBounds(130, 5, 20, 20);

        JLabel jLabel4 = new JLabel(":");

        jLabel4.setBounds(153, 5, 20, 20);

        field4_2.setBounds(160, 5, 20, 20);

        field4_1.requestFocus();

        box4.setBounds(105, 5, 20, 20);

        con.add(box4);

        con.add(field4_1);

        con.add(jLabel4);

        con.add(field4_2);


        final JCheckBox box5 = new JCheckBox();

        final JTextField field5_1 = new JTextField();

        final JTextField field5_2 = new JTextField();

        field5_1.setBounds(130, 40, 20, 20);

        JLabel jLabel5 = new JLabel(":");

        jLabel5.setBounds(153, 40, 20, 20);

        field5_2.setBounds(160, 40, 20, 20);

        box5.setBounds(105, 40, 20, 20);

        con.add(box5);

        con.add(field5_1);

        con.add(jLabel5);

        con.add(field5_2);

        //

        final JCheckBox box6 = new JCheckBox();

        final JTextField field6_1 = new JTextField();

        final JTextField field6_2 = new JTextField();

        field6_1.setBounds(130, 75, 20, 20);

        JLabel jLabel6 = new JLabel(":");

        jLabel6.setBounds(153, 75, 20, 20);

        field6_2.setBounds(160, 75, 20, 20);

        box6.setBounds(105, 75, 20, 20);

        con.add(box6);

        con.add(field6_1);

        con.add(jLabel6);

        con.add(field6_2);


        JButton queding = new JButton("ȷ��");

        queding.setBounds(5, 120, 175, 30);

        queding.addActionListener(new ActionListener() {


            @Override

            public void actionPerformed(ActionEvent e) {

                {

                    String string = field1_1.getText().toString();

                    String string2 = field1_2.getText().toString();

                    char a = string.charAt(0);// �п�

                    char b = string.charAt(1);// �п�

                    char c = string2.charAt(0);// ����

                    char d = string2.charAt(1);// ����

                    renshu1.setColnum1_1(a);

                    renshu1.setColnum2_1(b);

                    renshu1.setRownum1_1(c);

                    renshu1.setRownum2_1(d);

                    System.out.println(renshu1.getColnum1_1() + " "

                            + renshu1.getColnum2_1() + " "

                            + renshu1.getRownum1_1() + " "

                            + renshu1.getRownum2_1());

                }

                {

                    String string = field2_1.getText().toString();

                    String string2 = field2_2.getText().toString();

                    char a = string.charAt(0);// �п�

                    char b = string.charAt(1);// �п�

                    char c = string2.charAt(0);// ����

                    char d = string2.charAt(1);// ����

                    renshu2.setColnum1_2(a);

                    renshu2.setColnum2_2(b);

                    renshu2.setRownum1_2(c);

                    renshu2.setRownum2_2(d);

                    System.out.println(renshu2.getColnum1_2() + " "

                            + renshu2.getColnum2_2() + " "

                            + renshu2.getRownum1_2() + " "

                            + renshu2.getRownum2_2());

                }

            }

        });

        con.add(queding);

    }


    public static void main(String[] args) {

        RenshuDemo demo = new RenshuDemo();

        demo.setVisible(true);

    }


}



qq_慕斯卡5327552
浏览 687回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java