- package Test;
- import java.awt.*;
- import javax.swing.*;
- public class Cha {
- JFrame f;
- JPanel p;
- JLabel l1;
- JButton b1,b2;
- public Cha () {
- f = new JFrame("emmmm");
- p = new JPanel();
- l1= new JLabel("明天还会下雨嘛");
- b1 = new JButton("也许");
- b2 = new JButton("不会");
- f.setVisible(true);
- f.add(p);
- p.add(l1);
- p.add(b1);
- p.add(b2);
- f.setBounds(100, 100, 252, 250);
- p.setFont(new Font("宋体",Font.CENTER_BASELINE,20));
- p.setBackground(new Color(123,172,209));
- f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- new Cha();
- }
- }
立刻
来源: http://www.bubuko.com/infodetail-3061586.html