我现在有左右两部分,其中左边的部分比右边的宽度小,并且左边的部分又分成上下两部分,应该怎样部局呢.-------------------
|  A  |      B    |
|     |           |
|-----|           |
|  C  |           |
------------------- 

解决方案 »

  1.   

    JFrame默认BorderLayout 
    panel默认FlowLayout 
    个人认为比较好用的是GridLayout 
    当然还有用起来比较复杂的GridbagLayout 
    不过好像前三个基本足够用了
      

  2.   

    用jsplitpane类,先左右分,再在左边上下分,应该可以满足你的需求了
      

  3.   

    你这个的界面跟我的地图编辑器差不多,而我的地图编辑器界面设计就是用jsplitpane切分的
      

  4.   

    若用布局管理器用GridBagLayout
    下面是个示范, this是一个JFrame public MyBorderLayout(){

    Container cp = this.getContentPane();
    cp.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();

    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1.0;
    c.weighty = 1.0;
    c.fill = GridBagConstraints.BOTH;
    JPanel A = new JPanel();
    A.add(new JLabel("A"));
    A.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    cp.add(A, c);

    c.gridy = 1;
    c.fill = GridBagConstraints.BOTH;
    JPanel C = new JPanel();
    C.add(new JLabel("C"));
    C.setBorder(BorderFactory.createLineBorder(Color.BLUE));
    cp.add(C, c);

    c.gridx = 1;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 2;
    c.fill = GridBagConstraints.BOTH;
    JPanel B = new JPanel();
    B.add(new JLabel("B"));
    cp.add(B, c);

    this.setBounds(200, 200, 300, 300);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
      

  5.   

    用BoxLayout也可以,外面一个大的横向Box,
    里面再放一个竖向Box,这个竖向的Box里面放A、C
    外面的大Box在放一个B
    javax.swing.Box
      

  6.   

    单纯考虑布局用GridBagLayout 即可,
    如果可以拖动的用JSplitPane