水平的滚动条没有了,现在也想把垂直的滚动条也去掉。搞了很久了一直没找到好的解决方法。
这是基于JWebBrowser 的swing小程序。import java.awt.BorderLayout;import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;import chrriis.common.UIUtils;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;public class Mylegist extends JPanel { private static final long serialVersionUID = 1L; public Mylegist() {

super(new BorderLayout());
JScrollPane webBrowserPanel = new JScrollPane();
webBrowserPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
final JWebBrowser webBrowser = new JWebBrowser();

webBrowser.setBarsVisible(false);
webBrowser.navigate("http://localhost:8080/lawgeneral/index.html");
add(webBrowser, BorderLayout.CENTER);
} public static void main(String[] args) {
UIUtils.setPreferredLookAndFeel();
NativeInterface.open();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame("法务通");
frame.setUndecorated(true);// 禁用此窗体的装饰
frame.setLocationRelativeTo(null);//居中显示
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new Mylegist(), BorderLayout.CENTER);

frame.setSize(938, 614);

frame.setLocationByPlatform(true);
frame.setVisible(true);
}
});
NativeInterface.runEventPump();
}
}

解决方案 »

  1.   

    不用 JScrollPane 直接用JPane呗
      

  2.   


    为什么我的图不显示呢? http://blog.csdn.net/JavaAlpha/archive/2010/05/31/5637035.aspx
      

  3.   

     webBrowserPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);这句是设置水平滚动条从不显示
    为什么不尝试着添加
    webBrowserPanel.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);来设置一下呢?
      

  4.   

    水平的都写出来了,垂直的是一样的
    webBrowser.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
      

  5.   

    就是用的JPanel 加到 JFrame里面的。 上面的方法都试过的,才发的帖子。首先谢谢 楼上的各位的回答
    frame.getContentPane().add(new Mylegist(), BorderLayout.CENTER);
      

  6.   

    貌似我以前用GWT也碰到过一样的问题。后来也没有解决
      

  7.   

    在你的index.html文件 加入下面这句话就可以了。<body scroll="no">