我想在 Swing Native 浏览器中全屏运行你的视频,但我无法运行。我没有任何例外。在我的本机浏览器屏幕中,我的 jFarme 的左上角仅显示黑色十字按钮。在我的 32 位 Windows 机器中,它的工作文件。但是当我在 64 位 Windows 机器上尝试它时它不起作用。如果您对我的问题有所了解,请帮助我
我用过的罐子:
DJNativeSwing.jar
, DJNativeSwing-SWT.jar
,org.eclipse.swt.win32.win32.x86_64-4.3.jar
试过的网址
https://www.youtube.com/v/hk5IMmEDWH4
https://www.youtube.com/v/b-cr0ewwatk?fs=1
代码
public static void main(String[] args) {
NativeInterface.open();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame("YouTube Viewer");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.getContentPane().add(getBrowserPanel(), BorderLayout.CENTER);
frame.setSize(1024, 800);
frame.setLocationByPlatform(true);
frame.setVisible(true);
}
});
NativeInterface.runEventPump();
// don't forget to properly close native components
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
NativeInterface.close();
}
}));
}
public static JPanel getBrowserPanel() {
JPanel webBrowserPanel = new JPanel(new BorderLayout());
JWebBrowser webBrowser = new JWebBrowser();
webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
webBrowser.setBarsVisible(false);
webBrowser.navigate(URL);
return webBrowserPanel;
}