求用过native swing的大神帮忙
import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JFrame;
import chrriis.common.UIUtils;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
public class SwingHello extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* @param args
*/
static Container c;
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(getGUI(), BorderLayout.CENTER);
frame.setSize(938, 614);
frame.setLocationByPlatform(true);
frame.setVisible(true);
}
});
NativeInterface.runEventPump();
}
public static JScrollPane getGUI(){
JScrollPane webBrowserPanel = new JScrollPane();
webBrowserPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
final JWebBrowser webBrowser = new JWebBrowser();
webBrowser.setBarsVisible(false);
webBrowser.navigate("table.html");
webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
return webBrowserPanel;
}
}
报错:
Exception in thread "main" java.lang.IllegalStateException: The version of SWT that is required is 3.5M6 or later!
at chrriis.dj.nativeswing.swtimpl.NativeInterface.initialize(NativeInterface.java:149)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:182)
at SwingHello.main(SwingHello.java:30)
import java.awt.Container;
import javax.swing.JFrame;
import chrriis.common.UIUtils;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
public class SwingHello extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* @param args
*/
static Container c;
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(getGUI(), BorderLayout.CENTER);
frame.setSize(938, 614);
frame.setLocationByPlatform(true);
frame.setVisible(true);
}
});
NativeInterface.runEventPump();
}
public static JScrollPane getGUI(){
JScrollPane webBrowserPanel = new JScrollPane();
webBrowserPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
final JWebBrowser webBrowser = new JWebBrowser();
webBrowser.setBarsVisible(false);
webBrowser.navigate("table.html");
webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
return webBrowserPanel;
}
}
报错:
Exception in thread "main" java.lang.IllegalStateException: The version of SWT that is required is 3.5M6 or later!
at chrriis.dj.nativeswing.swtimpl.NativeInterface.initialize(NativeInterface.java:149)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:182)
at SwingHello.main(SwingHello.java:30)
...全文
相关推荐
DJ-Native-Swing源码
DJ-Native-Swing 是一个开源项目,其源码旨在提供一种方式,使Java Swing应用程序能够利用操作系统本机的UI风格和功能。
46、Java编程中的Native方法、this关键字及Swing框架介绍
本文介绍了Java编程中的三个核心主题:Native方法、this关键字以及Swing框架。首先,讲解了如何使用native关键字调用本地代码,接着详细说明了this()在构造函数中的用途及其限制,最后全面介绍了Swing框架的基本概念、组件体系结构、容器层次结构及事件处理机制,并提供了多个示例代码帮助理解。文章还比较了Swing与其他GUI框架(如JavaFX)的特点和适用场景,为开发者提供学习建议和未来发展方向。
DJ Native Swing内嵌浏览器实例
通过这种方式,DJ Native Swing可以确保应用程序中的Web内容呈现与用户在其日常浏览器中看到的一致。DJ Native Swing的主要特点包括:1.
swt源码和jar包dj-native-swing-swt.jar
dj-native-swing"是前面提到的结合Swing和SWT的库。
DJ-Native-Swing-master
"DJ-Native-Swing-master 是一个Java库,用于在Swing应用程序中嵌入原生组件,特别是提供了一个内置的丰富Web浏览器、Flash播放器、HTML编辑器、媒体播放器和语法高亮


Java SE
