Launch several JavaFX window from Eclipse IDE [message #1477389] |
Mon, 17 November 2014 21:49 |
Arthur Daussy Messages: 14 Registered: September 2014 |
Junior Member |
|
|
Hello,
I working on a personal project and I would like to launch multiple JavaFX dialogs (or windows) from a Running Eclipse (even if they can not be displayed at the time). I would like to create those dialogs/windows programmatically since I want to use some Java object collected from the current Eclipse IDE.
To do so, my first idea was to use the FXCanvas in a SWT dialog. However my UI uses a lot of animations which run really slowly in such dialogs (whereas they are really smooth in pure JavaFX application). Am I missing something here or is it a known issue with FXCanvas?
My second idea was to launch a new Application (using your org.eclipse.fx.osgi.util.AbstractJFXApplication) for each dialog. This time everything look nice on the first launch. I even succeed in using java object in my dialogs (using a custom IApplicationContext). However, I failed to launch a second application. Each time I got an IllegalStateException launched from LauncherImpl.launchApplication [1]. So I guess this is a limitation form JavaFX?
My third try was a bit more twisted. I tried to launch pure JavaFX windows from Java code. It looks like this:
com.sun.javafx.application.PlatformImpl.startup(new Runnable() {
@Override
public void run() {
Stage primaryStage = new Stage();
primaryStage.impl_setPrimary(true); // I have tried both using or mevogin this line
Scene scene = .. // Some cone that created a scene
primaryStage.setScene(scene);
primaryStage.setWidth(scene.getWidth());
primaryStage.setHeight(scene.getHeight());
primaryStage.setTitle("A title");
primaryStage.show();
}
});
However my JVM machine crashes with the following error (see detail in attachment):
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fb6ef0c1441, pid=3455, tid=140420212356864
#
# JRE version: Java(TM) SE Runtime Environment (8.0_40-b07) (build 1.8.0_40-ea-$
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.40-b11 mixed mode linux-amd64 )
# Problematic frame:
# V [libjvm.so+0x671441] JavaThread::last_frame()+0xa1
#
# Failed to write core dump. Core dumps have been disabled. To enable core dump$
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Since I'm using non API and deprecated API code I guess it's not the correct way to do it but I wanted to give it a try.
Could you guive me some leads on how I could achieve tis? (Or tells me that this is a limitation from JavaFX or OSGI)
Anyway thanks for any help that you can give.
Regards,
Arthur Daussy
[1] com.sun.javafx.application.LauncherImpl.launchApplication(Class<? extends Application>, Class<? extends Preloader>, String[])
I would like to know if there is any way to launch several time the same JavaFX application programmatically. For the moment I have try to use your applica
|
|
|
|
Re: Launch several JavaFX window from Eclipse IDE [message #1477957 is a reply to message #1477389] |
Tue, 18 November 2014 08:52 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Hi,
Look at how FXCanvas does the bootstrap, it does set some internal
fields, I don't think you really want to do this but the following
should work just fine:
-----8<-----
void openFXWindow() {
// Dummy to let FXCanvas init JavaFX appropiately
Shell s = new Shell();
new FXCanvas(s);
s.dispose();
Stage s = new Stage();
// fill your stage
s.show();
}
-----8<-----
I'm using the same trick in my Swing-SWT-Embedding
http://tomsondev.bestsolution.at/2014/02/10/embedding-swing-into-swt-on-java8/
Tom
On 17.11.14 22:49, Arthur Daussy wrote:
> Hello,
>
> I working on a personal project and I would like to launch multiple JavaFX dialogs (or windows) from a Running Eclipse (even if they can not be displayed at the time). I would like to create those dialogs/windows programmatically since I want to use some Java object collected from the current Eclipse IDE.
>
> To do so, my first idea was to use the FXCanvas in a SWT dialog. However my UI uses a lot of animations which run really slowly in such dialogs (whereas they are really smooth in pure JavaFX application). Am I missing something here or is it a known issue with FXCanvas?
>
> My second idea was to launch a new Application (using your org.eclipse.fx.osgi.util.AbstractJFXApplication) for each dialog. This time everything look nice on the first launch. I even succeed in using java object in my dialogs (using a custom IApplicationContext). However, I failed to launch a second application. Each time I got an IllegalStateException launched from LauncherImpl.launchApplication [1]. So I guess this is a limitation form JavaFX?
>
> My third try was a bit more twisted. I tried to launch pure JavaFX windows from Java code. It looks like this:
>
> com.sun.javafx.application.PlatformImpl.startup(new Runnable() {
> @Override
> public void run() {
> Stage primaryStage = new Stage();
> primaryStage.impl_setPrimary(true); // I have tried both using or mevogin this line
> Scene scene = .. // Some cone that created a scene
> primaryStage.setScene(scene);
> primaryStage.setWidth(scene.getWidth());
> primaryStage.setHeight(scene.getHeight());
> primaryStage.setTitle("A title");
> primaryStage.show();
> }
> });
>
> However my JVM machine crashes with the following error (see detail in attachment):
>
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> # SIGSEGV (0xb) at pc=0x00007fb6ef0c1441, pid=3455, tid=140420212356864
> #
> # JRE version: Java(TM) SE Runtime Environment (8.0_40-b07) (build 1.8.0_40-ea-$
> # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.40-b11 mixed mode linux-amd64 )
> # Problematic frame:
> # V [libjvm.so+0x671441] JavaThread::last_frame()+0xa1
> #
> # Failed to write core dump. Core dumps have been disabled. To enable core dump$
> #
> # If you would like to submit a bug report, please visit:
> # http://bugreport.sun.com/bugreport/crash.jsp
> # The crash happened outside the Java Virtual Machine in native code.
> # See problematic frame for where to report the bug.
> #
>
> Since I'm using non API and deprecated API code I guess it's not the correct way to do it but I wanted to give it a try.
>
> Could you guive me some leads on how I could achieve tis? (Or tells me that this is a limitation from JavaFX or OSGI)
>
> Anyway thanks for any help that you can give.
>
> Regards,
>
> Arthur Daussy
>
>
> [1] com.sun.javafx.application.LauncherImpl.launchApplication(Class<? extends Application>, Class<? extends Preloader>, String[])
> I would like to know if there is any way to launch several time the same JavaFX application programmatically. For the moment I have try to use your applica
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03816 seconds