randomframe2.java~7~

来自「java环境开发」· JAVA~7~ 代码 · 共 96 行

JAVA~7~
96
字号
package cxyex;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Rectangle;
import java.awt.Color;
import javax.swing.JTextField;
import javax.swing.JButton;

import java.util.Random;
/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2008</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class RandomFrame2 extends JFrame {
    public RandomFrame2() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        getContentPane().setLayout(null);
        jLabel1.setText("考验你的数字意识");
        jLabel1.setBounds(new Rectangle(103, 39, 217, 21));
        lblrad1.setBackground(Color.red);
        lblrad1.setOpaque(true);
        lblrad2.setBackground(Color.red);
        lblrad2.setOpaque(true);
        lblrad3.setBackground(Color.red);
        lblrad3.setOpaque(true);
        lblrad4.setBackground(Color.red);
        lblrad4.setOpaque(true);
        txtrad.setBounds(new Rectangle(118, 157, 77, 20));
        jButton1.setBounds(new Rectangle(64, 223, 81, 23));
        jButton1.setText("猜数");
        jButton2.setBounds(new Rectangle(177, 224, 81, 23));
        jButton2.setText("关闭");
        lblshow.setBackground(Color.pink);
        lblshow.setOpaque(true);
        lblshow.setBounds(new Rectangle(57, 189, 215, 25));
        jButton3.setBounds(new Rectangle(272, 225, 81, 23));
        jButton3.setText("重新开始");
        this.getContentPane().add(jLabel1);
        jLabel6.setText("请输入");
        jLabel6.setBounds(new Rectangle(53, 155, 42, 15));
        lblrad4.setBounds(new Rectangle(272, 90, 42, 34));
        lblrad3.setBounds(new Rectangle(200, 90, 42, 34));
        lblrad2.setBounds(new Rectangle(128, 90, 42, 34));
        //10-40
        x=r.nextInt(30)+10;



        this.getContentPane().add(jLabel6);
        this.getContentPane().add(lblrad1);
        this.getContentPane().add(lblrad2);
        this.getContentPane().add(lblrad3);
        this.getContentPane().add(lblrad4);
        this.getContentPane().add(txtrad);
        this.getContentPane().add(jButton1);
        this.getContentPane().add(jButton2);
        this.getContentPane().add(lblshow);
        this.getContentPane().add(jButton3);
        lblrad1.setBounds(new Rectangle(56, 90, 42, 34));
        this.setTitle("考验你的数字意识");
    }

    JLabel jLabel1 = new JLabel();
    JLabel lblrad1 = new JLabel();
    JLabel lblrad2 = new JLabel();
    JLabel lblrad3 = new JLabel();
    JLabel lblrad4 = new JLabel();
    JLabel jLabel6 = new JLabel();
    JTextField txtrad = new JTextField();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    JLabel lblshow = new JLabel();
    JButton jButton3 = new JButton();
    Random r=new Random();
    int x;

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?