标题:请各位前辈帮忙看看,我的程序为什么不显添的所有组件,谢谢!
取消只看楼主
sql377288
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-1-16
 问题点数:0 回复次数:0 
请各位前辈帮忙看看,我的程序为什么不显添的所有组件,谢谢!
请各位前辈帮忙看看,我的程序为什么不显添的所有组件,谢谢!
import java.awt.*;
import javax.swing.*;
public class text12 {
    public static void main(String[] args){
    JFrame f=new JFrame("任务二");
    f.setLocation(100,100);
    f.setSize(600,1000);
    JPanel fr=new JPanel();//面板1
    fr.setLocation(200,100);
    fr.setSize(100,100);
    f.getContentPane().add(fr);
    JLabel a=new JLabel("学号");
    JTextField b=new JTextField(10);
    fr.add(a);
    fr.add(b);
    fr.setLayout(new FlowLayout(FlowLayout.CENTER));
    JPanel fn=new JPanel();//面板2
    fn.setLocation(200,300);
    fn.setSize(100,100);
    f.getContentPane().add(fn);
    JLabel c=new JLabel("姓名");
    JTextField d=new JTextField(10);
    fn.add(c);
    fn.add(d);
    fn.setLayout(new FlowLayout(FlowLayout.CENTER));
    JPanel fm=new JPanel();//面板3
    fm.setLocation(200,500);
    fm.setSize(100,100);
    JLabel e=new JLabel("性别");
    JRadioButton j=new JRadioButton("男");
    JRadioButton h=new JRadioButton("女");
    JCheckBox m=new JCheckBox("团员");
    fm.add(e);
    fm.add(j);
    fm.add(h);
    fm.add(m);
    fm.setLayout(new FlowLayout(FlowLayout.CENTER));
    JPanel fj=new JPanel();//面板4
    fr.setLocation(200,800);
    fr.setSize(100,100);
    JLabel x=new JLabel("班级");
    JTextField y=new JTextField(10);
    fj.add(x);
    fj.add(y);
    fj.setLayout(new FlowLayout(FlowLayout.CENTER));
    JPanel fh=new JPanel();//面板5
    fr.setLocation(200,900);
    fr.setSize(100,100);
    JLabel i=new JLabel("简介");
    JTextArea p=new JTextArea(3,10);
    fh.add(i);
    fh.add(p);
    fh.setLayout(new FlowLayout(FlowLayout.CENTER));
   // f.add(new Button("确定"));
    f.setLayout(new FlowLayout(FlowLayout.CENTER));
    f.setVisible(true);
    }
}
搜索更多相关主题的帖子: public import 
2014-05-27 10:23



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-432121-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.453589 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved