Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » javafx used in linux eclipse RCP swt(javafx used in linux eclipse RCP swt)
icon11.gif  javafx used in linux eclipse RCP swt [message #1734014] Fri, 03 June 2016 03:19
ljm ljm is currently offline ljm ljmFriend
Messages: 1
Registered: June 2016
Junior Member
hello,
I want to use JFXPanel in linux eclipse RCP Swt, but I have a problem´╝î
error info :
Exception in thread "JavaFX Application Thread" org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4397)
at org.eclipse.swt.SWT.error(SWT.java:4312)
at org.eclipse.swt.SWT.error(SWT.java:4283)
at org.eclipse.swt.widgets.Widget.error(Widget.java:481)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:419)
at org.eclipse.swt.custom.CTabFolder.setSelectionForeground(CTabFolder.java:3298)
at org.eclipse.ui.internal.presentations.PaneFolder.setSelectionForeground(PaneFolder.java:761)
at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.updateColors(DefaultTabFolder.java:467)
at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.shellActive(DefaultTabFolder.java:483)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder$2.shellDeactivated(PresentablePartFolder.java:70)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:111)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1397)
at org.eclipse.swt.widgets.Shell.filterProc(Shell.java:774)
at org.eclipse.swt.widgets.Display.filterProc(Display.java:1566)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication$3$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
this source core :
public class TestView
{
public static void main(String[] args)
{
final String htmlfile = "file:///home/line.html";
Display display = new Display();
Shell shell = new Shell(display);
shell.setText(" Hello World");
shell.setBounds(100, 100, 300, 100);
shell.setLayout(new FillLayout());
Button btn = new Button(shell, SWT.CENTER);
btn.setText("Button");
btn.addSelectionListener(new SelectionAdapter()
{
@Override
public void widgetSelected(SelectionEvent e)
{
System.out.println("click button!");
{
JFrame frame = new JFrame("Swing and JavaFX");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
{
final JFXPanel fxPanel = new JFXPanel();
Platform.runLater(new Runnable()
{
@Override
public void run()
{
StackPane root = new StackPane();
Scene scene = new Scene(root);
WebView webView = new WebView();
WebEngine webEngine = webView.getEngine();
webEngine.load(htmlfile);
root.getChildren().add(webView);
fxPanel.setScene(scene);
}
});
frame.add(fxPanel, BorderLayout.CENTER);
}
frame.pack();
frame.setSize(640, 480);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
});
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
Previous Topic:Eclipse Java 4.5 Mars .2: Create a Java Project Wizard GUI Hung -- how to remove GUI from desktop?
Next Topic:Excel file getting corrupted
Goto Forum:
  


Current Time: Sun Sep 15 12:00:41 GMT 2019

Powered by FUDForum. Page generated in 0.03309 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top