代码

1flow layout 流式管理器

2border layout 边框管理器

3 grid layout网格布局管理器

4boxlayout 盒式布局管理器

图形界面gui m--数据模型  v---试图模型  c---控制器U

jpannel 面板 button 按钮 lable 标签 textfield 文本输入框 checkbox 多选框 radio 多选框

import java.awt.Button;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;

public class Test extends JFrame  {
 public Test(String titel){
  super(titel);
  this.setSize(500,400);
  this.setVisible(true);
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  this.setLocationRelativeTo(null);
  JButton but=new JButton("确定");
  but.setBounds(200, 200, 100, 100);
  this.add(but);
  
  JCheckBox check=new JCheckBox("跳水");
  check.setBounds(50, 50, 50, 50);
  this.add(check);
  JCheckBox check1=new JCheckBox("骑马");
  check1.setBounds(50, 100, 50,50);
  this.add(check1);
  JCheckBox check3=new JCheckBox("游泳");
  check3.setBounds(50, 150, 50, 50);
  this.add(check3);
   

posted @ 2016-04-21 22:40  、Bingly、  阅读(121)  评论(0)    收藏  举报