《Java课程实习》日志(周二)

import java.awt.EventQueue;


import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import javax.swing.JButton;

import javax.swing.JTextField;

import javax.swing.JLabel;

import java.awt.Color;

import java.awt.SystemColor;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



public class Guess01 extends JFrame {


    /**

     * 

     */

    private static final long serialVersionUID = 1L;

    

    private JPanel contentPane;

    private JTextField tfDir;

    private JTextField tfClass;


    /**

     * Launch the application.

     */

    public static void main(String[] args) {

        EventQueue.invokeLater(new Runnable() {

            public void run() {

                try {

                    Guess01 frame = new Guess01();

                    frame.setVisible(true);

                } catch (Exception e) {

                    e.printStackTrace();

                }

            }

        });

    }


    /**

     * Create the frame.

     */

    public Guess01() {

        setTitle("\u731C\u731C\u770B\u6E38\u620FV0.1");

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        setBounds(100, 100, 645, 409);

        contentPane = new JPanel();

        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

        setContentPane(contentPane);

        contentPane.setLayout(null);

        

        // 选择目录 按钮的处理程序

        JButton btnDir = new JButton("\u9009\u62E9\u76EE\u5F55");

        btnDir.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {

                

            }

        });

        btnDir.setBounds(26, 26, 93, 23);

        contentPane.add(btnDir);

        

        // 文本框,显示目录

        tfDir = new JTextField();

        tfDir.setEditable(false);

        tfDir.setBounds(125, 27, 363, 21);

        contentPane.add(tfDir);

        tfDir.setColumns(10);

        

        // 选择班级 按钮的处理程序

        JButton btnClass = new JButton("\u9009\u62E9\u73ED\u7EA7");

        btnClass.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                

            }

        });

        btnClass.setBounds(26, 59, 93, 23);

        contentPane.add(btnClass);

        

        // 文本框,显示班级文件

        tfClass = new JTextField();

        tfClass.setEditable(false);

        tfClass.setBounds(125, 60, 363, 21);

        contentPane.add(tfClass);

        tfClass.setColumns(10);

        

        // 标签,显示带猜测学生姓名

        JLabel lbGuessName = new JLabel("\u59D3\u540D");

        lbGuessName.setBounds(259, 91, 102, 23);

        contentPane.add(lbGuessName);

        import java.awt.EventQueue;


import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import javax.swing.JButton;

import javax.swing.JTextField;

import javax.swing.JLabel;

import java.awt.Color;

import java.awt.SystemColor;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



public class Guess01 extends JFrame {


    /**

     * 

     */

    private static final long serialVersionUID = 1L;

    

    private JPanel contentPane;

    private JTextField tfDir;

    private JTextField tfClass;


    /**

     * Launch the application.

     */

    public static void main(String[] args) {

        EventQueue.invokeLater(new Runnable() {

            public void run() {

                try {

                    Guess01 frame = new Guess01();

                    frame.setVisible(true);

                } catch (Exception e) {

                    e.printStackTrace();

                }

            }

        });

    }


    /**

     * Create the frame.

     */

    public Guess01() {

        setTitle("\u731C\u731C\u770B\u6E38\u620FV0.1");

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        setBounds(100, 100, 645, 409);

        contentPane = new JPanel();

        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

        setContentPane(contentPane);

        contentPane.setLayout(null);

        

        // 选择目录 按钮的处理程序

        JButton btnDir = new JButton("\u9009\u62E9\u76EE\u5F55");

        btnDir.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {

                

            }

        });

        btnDir.setBounds(26, 26, 93, 23);

        contentPane.add(btnDir);

        

        // 文本框,显示目录

        tfDir = new JTextField();

        tfDir.setEditable(false);

        tfDir.setBounds(125, 27, 363, 21);

        contentPane.add(tfDir);

        tfDir.setColumns(10);

        

        // 选择班级 按钮的处理程序

        JButton btnClass = new JButton("\u9009\u62E9\u73ED\u7EA7");

        btnClass.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                

            }

        });

        btnClass.setBounds(26, 59, 93, 23);

        contentPane.add(btnClass);

        

        // 文本框,显示班级文件

        tfClass = new JTextField();

        tfClass.setEditable(false);

        tfClass.setBounds(125, 60, 363, 21);

        contentPane.add(tfClass);

        tfClass.setColumns(10);

        

        // 标签,显示带猜测学生姓名

        JLabel lbGuessName = new JLabel("\u59D3\u540D");

        lbGuessName.setBounds(259, 91, 102, 23);

        contentPane.add(lbGuessName);

        

        // 标签,显示第一个学生相片
diamondsButton[cols][rows] = new JButton(String .valueOf(grid[cols + 1][rows + 1]));
diamondsButton[cols][rows].setIcon(icons[grid[cols + 1][rows + 1])]);
ImageIcon icons[]= new ImageIcon[25];

        JLabel lblImg1 = new JLabel("\u56FE\u72471");

        lblImg1.addMouseListener(new MouseAdapter() {

            @Override

            public void mouseClicked(MouseEvent arg0) {

                

            }

        });

        lblImg1.setBounds(26, 151, 183, 178);

        contentPane.add(lblImg1);

        

        // 标签,显示第二个学生相片

        JLabel lblImg2 = new JLabel("\u56FE\u72472");

        lblImg2.addMouseListener(new MouseAdapter() {

            @Override

            public void mouseClicked(MouseEvent e) {

                

            }

        });

        lblImg2.setForeground(Color.BLACK);

        lblImg2.setBackground(SystemColor.inactiveCaption);

        lblImg2.setBounds(241, 155, 183, 172);

        contentPane.add(lblImg2);

        

        // 标签,显示第三个学生相片

        JLabel lblImg3 = new JLabel("\u56FE\u72473");

        lblImg3.addMouseListener(new MouseAdapter() {

            @Override

            public void mouseClicked(MouseEvent e) {

                

            }

        });

        lblImg3.setBounds(434, 155, 185, 172);

        contentPane.add(lblImg3);

        

        // 再猜一次 按钮,点击则更新相应的三张图片 与 带猜测学生姓名

        JButton btnGuessAgain = new JButton("\u518D\u731C\u4E00\u6B21");

        btnGuessAgain.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                

            }

        });

        btnGuessAgain.setBounds(223, 337, 93, 23);

        contentPane.add(btnGuessAgain);

    }

}

        // 标签,显示第一个学生相片

        JLabel lblImg1 = new JLabel("\java\01");

        lblImg1.addMouseListener(new MouseAdapter() {

            @Override

            public void mouseClicked(MouseEvent arg0) {

                

            }

        });

        lblImg1.setBounds(26, 151, 183, 178);

        contentPane.add(lblImg1);

        

        // 标签,显示第二个学生相片

        JLabel lblImg2 = new JLabel("\java\02");

        lblImg2.addMouseListener(new MouseAdapter() {

            @Override

            public void mouseClicked(MouseEvent e) {

                

            }

        });

        lblImg2.setForeground(Color.BLACK);

        lblImg2.setBackground(SystemColor.inactiveCaption);

        lblImg2.setBounds(241, 155, 183, 172);

        contentPane.add(lblImg2);

        

        // 标签,显示第三个学生相片

        JLabel lblImg3 = new JLabel("\java\03");

        lblImg3.addMouseListener(new MouseAdapter() {

            @Override

            public void mouseClicked(MouseEvent e) {

                

            }

        });

        lblImg3.setBounds(430, 150, 180, 160);

        contentPane.add(lblImg3);

        

        // 再猜一次 按钮,点击则更新相应的三张图片 与 带猜测学生姓名

        JButton btnGuessAgain = new JButton("\u518D\u731C\u4E00\u6B21");

        btnGuessAgain.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                

            }

        });

        btnGuessAgain.setBounds(200, 300, 100, 30);

        contentPane.add(btnGuessAgain);

    }

}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值