本帖最后由 kisslylips 于 2011-09-27 12:22:31 编辑

解决方案 »

  1.   

    代码如下:
    Box userBox = Box.createVerticalBox();
    NodeIcon nodeIcon=new NodeIcon("123.png", true);
    NodeIcon nodeIcon1=new NodeIcon("123.png", true);
    Box b = Box.createVerticalBox();
    b.add(nodeIcon);
    JPanel j =new JPanel();
    JPanel j1 =new JPanel();
    j.add(b);
    Box a = Box.createVerticalBox(); 
    a.add(nodeIcon1);
    j1.add(a);
    userBox.add(j);
    userBox.add(j1);
    this.add(userBox);
    this.pack();
    this.setVisible(true);
      

  2.   

    就是如何把用户的Jpanel 组件固定的添加到Box里面,让JPanel组件不随外部组件放大,而JPanel组件变大。
      

  3.   

    楼主有试过设置JPanel的大小不,JPanel.setPreferredSize();或者你再加一层JPanel