java布局问题.这个怎么来布局

public void Wuziqi_jiemianUI(){
        setTitle(title);
        setSize(400, 400);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        setLayout(new GridLayout(2, 1));
        
        JPanel jptop = new JPanel();
        JLabel jltishi = new JLabel();
        jltishi.setText(gametishi);
        jltishi.setFont(new Font("宋体", Font.BOLD, 15));
        jptop.add(jltishi,BorderLayout.CENTER);
        add(jptop);
        JPanel jpmain = new JPanel();
        
        jpmain.setLayout(new FlowLayout());
        JPanel jpmainright = new JPanel();
        jpmainright.setLayout(new GridLayout(6, 1, 10, 10));
        jpmainright.add(start);
        jpmainright.add(setting);
        jpmainright.add(help);
        jpmainright.add(end);
        jpmainright.add(version);
        jpmainright.add(exit);
        jpmain.add(qipan);
        jpmain.add(jpmainright,BorderLayout.WEST);
        add(jpmain);
        
        JPanel jpbuttom = new JPanel();
        jpbuttom.setLayout(new FlowLayout());
        jpbuttom.setSize(100, 50);
        jpbuttom.add(heitext);
        jpbuttom.add(baitext);
        
        add(jpbuttom,BorderLayout.SOUTH);
    }

怎么做成这个布局效果?

2014-03-21 22:28 提问者采纳
1
2
3
4
5
6
7
jpmain.setlayout( new  BorderLayout);
jpmain.add(panel1, BorderLayout.North);
JPanel centerPanel =  new  JPanel();
centerPanel.add(panel2); //CenterPanel可能需要用到GridbayLayout来控panel2, 3的相对占的比例
centerPanel.add(panel3);
jpmain.add(centerPanel, BorderLayout.CENTER);
jpmain.add(panel4, BorderLayout.SOUTH);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值