什么分隔线啊?如果是菜单栏的分隔线就用楼上的
如果是面板上的,可以用JSplitPane来解决。

解决方案 »

  1.   

    是面板上的、不是分栏的。类似html里的<HR>那种的、有点凹的一条线。就相当于菜单上的那种。
      

  2.   

    import java.awt.*;
    import javax.swing.*;public class Test extends JApplet {
    public void init() {
    Container contentPane = getContentPane();
    JSeparator s = new JSeparator(JSeparator.VERTICAL);
    Dimension ps = s.getPreferredSize(); contentPane.setLayout(new FlowLayout()); contentPane.add(new JButton("left"));
    contentPane.add(s);
    contentPane.add(new JButton("right")); s.setPreferredSize(new Dimension(ps.width, 50));
    }
    }
      

  3.   

    用了JSeparator还是看不到分隔线啊。
      

  4.   

    可以自己画,上面是灰色的,下面是白色的两条线,也可以用带边框的PANEL,将其高度调低就可以了!!
      

  5.   

    修改JSeparator默认的大小后就能看见
      

  6.   

    private javax.swing.JSeparator s = null;
    ...
    jContentPane.add(getJSeparator(), null);
    ...
    private javax.swing.JSeparator getJSeparator() {
         if (s == null) {
    s = new JSeparator();
         }
         return s;
    }
    我的文件里有了以上代码后为何看不到分隔线?
      

  7.   

    要设置面板的布局方式为BoxLayout,否则必须设置JSeperator的大小才能看见。