Jfx в Swing настольном приложении Crashing
Я написал JFX на качелях для веб-просмотра. Я написал Jfx и качаться в разных темах, но он все еще падает. Приложение падает после некоторого времени. Это настольное приложение.
Для вашей информации, вот содержание в файле журнала
1. #
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000005d9fedc1, pid=11180, tid=0x0000000000002d58
#
# JRE version: Java(TM) SE Runtime Environment (8.0_161-b12) (build 1.8.0_161-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.161-b12 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [jfxwebkit.dll+0x53edc1]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x0000000059893000): JavaThread "JavaFX Application
Thread" [_thread_in_native, id=11608,
stack(0x000000005b3b0000,0x000000005b4b0000)]
siginfo: ExceptionCode=0xc0000005, reading address
0x00000000000000a0
Код:
public class MainPage extends JFrame {
private JPanel contentPane;
private WebView browser;
private JFXPanel jfxPanel;
private WebEngine webEngine;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainPage frame = new MainPage();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
* @throws SQLException
* @throws ClassNotFoundException
*/
public MainPage() throws ClassNotFoundException, SQLException {
setTitle("SMRC");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 887, 493);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JPanel leftpanel = new JPanel();
leftpanel.setLayout(new GridLayout(0, 1, 0, 0));
// To add web page
final JFXPanel jfxPanel = new JFXPanel();
leftpanel.add(jfxPanel);
Platform.runLater( () -> { // FX components need to be managed by JavaFX
WebView webView = new WebView();
webView.getEngine().loadContent( "<html> Hello World!" );
webView.getEngine().load( "http://127.0.0.1/" );
jfxPanel.setScene( new Scene( webView ) );
});
JPanel rightpanel1 = new JPanel();
JPanel rightpanel2 = new JPanel();
JPanel rightpanel3 = new JPanel();
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(leftpanel, GroupLayout.PREFERRED_SIZE, 774, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
.addComponent(rightpanel3, GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)
.addComponent(rightpanel2,GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)
.addComponent(rightpanel1, GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)))
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(rightpanel1, GroupLayout.PREFERRED_SIZE, 220, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(rightpanel2, GroupLayout.PREFERRED_SIZE, 220, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(rightpanel3, GroupLayout.PREFERRED_SIZE, 220, GroupLayout.PREFERRED_SIZE))
.addComponent(leftpanel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 445, Short.MAX_VALUE)
);
rightpanel3.setLayout(new GridLayout(1, 0, 0, 0));
rightpanel2.setLayout(new GridLayout(1, 0, 0, 0));
rightpanel1.setLayout(new GridLayout(1, 0, 0, 0));
contentPane.setLayout(gl_contentPane);
}
}