Panel mainpanel=new Panel();
 Panel topPanel=new Panel();
  topPanel.setLayout(new GridLayout(1,1));
  mainpanel.add(topPanel);
  Panel scrollPanel=new Panel();
  scrollPanel.setLayout(new GridLayout(3,1));
  mainpanel.add(scrollPanel);
  Panel bottomPanel=new Panel();
   bottomPanel.setLayout(new GridLayout(3,1));
  mainpanel.add(bottomPanel);

解决方案 »

  1.   

    If you wanted simple,You can set the layout is null,then arrange the component in the container,Last, Set the layout is GridBagLayout,Maybe you neeed adjust anchor, and other parameter.
    JBuilder is a good layout tool,You can use.
    qingtingying(ting)'s is good
      

  2.   

    panel自身的布局管理器是flowlayout,作为容器,它自身的大小取决于其上的控件大小,jscrollpane亦如此。
    建议可采用boxlayout来做尝试。
      

  3.   

    gbc.gridx = x;
            gbc.gridy = y;
            gbc.gridwidth = w;
            gbc.gridheight = h;参数设定有问题! GridBagConstraints 还是非常很好的,能精确的控制界面
    不知道你的所说的布局的确切意义,具体说说,然后再试试看(把上面我说的参数重置!)
    其实还有两个参数fill和anchor 
    你在描述一下你的布局,我可以帮你试试看!
      

  4.   

    qingtingying(ting)  我以后这个类是Applet,那么mainPanel的默认布局不就是flowLayout了?这样能让它们同时显示么?