Stage hide/show from Swing

Tom Schindl tom.schindl at bestsolution.at
Mon May 18 14:26:22 UTC 2015


So then simply call Platform.setImplicitExit(false)?

Tom

On 18.05.15 16:19, Matthias Hänel wrote:
> Thanks Scott for your fast answer.
> 
> 
> Well, in this case 
> 
> PlatformImpl.runLater(new Runnable()
> {
>     @Override
>     public void run()
> 	{
> 		...
> 
> 
> is never called. I believe it is not called because the Stage is not running anymore and 
> therefore the JFX Main Thread is stopped.
> 
> I am now on 1.8.0_60 and have still the same behaviour :(
> 
> 
> regards
> Matthias
> 
> 
> 
> 
>> Am 18.05.2015 um 14:17 schrieb Scott Palmer <swpalmer at gmail.com>:
>>
>> I would have thought that #2 was correct. What happened when you tried it?
>> Did you make sure JavaFX didn't try to shutdown automatically when the last Stage was hidden?
>>
>>
>> Scott
>>
>>> On May 18, 2015, at 7:37 AM, Matthias Hänel <haenel at ultramixer.com> wrote:
>>>
>>> Hello there,
>>>
>>>
>>> I have a stage that is been called from a Java Swing application. This is not a real problem
>>> since I can run follwing code:
>>>
>>> PlatformImpl.startup(new Runnable()
>>> {
>>>   @Override
>>>   public void run()
>>>   {
>>>       myStage = new myStage();
>>>       myStage.show();
>>>   }
>>> });
>>>
>>>
>>> That works so far. 
>>>
>>> No I would like to close this stage from the swing application. I can call:
>>>
>>> Platform.runLater(new Runnable()
>>> {
>>>   @Override
>>>   public void run()
>>>   {
>>>       myStage.hide();
>>>   }
>>> });
>>>
>>>
>>> This also works. 
>>>
>>> Since I have a toggle-Button to hide and show the stage from the swing application, I would like
>>> to re-show the stage and I would like to know when the stage is showing or not. This seems to be nearly impossible by now.
>>>
>>> What did I try?
>>>
>>> 1. I tried to shutdown the javafx entire with com.sun.javafx.tk.Toolkit.getToolkit().exit(); in the hide process. So I expected to use PlatformImpl.startup again. Unfortunately, it did not work.
>>>
>>> 2. I tried to leave javafx untouched. The second time I only call PlatformImpl.runLater to create a new scene.
>>>
>>> 3. I tried to run it from the swing thread without Platform.run... ... this failed obviuosly. (I just had no further ideas ;)) 
>>>
>>>
>>> Does anyone tried this before? Any advise will be helpful :)
>>>
>>>
>>>
>>> Thanks in advance
>>> Matthias
>>>
>>>
>>>
> 


-- 
Thomas Schindl, CTO
BestSolution.at EDV Systemhaus GmbH
Eduard-Bodem-Gasse 5-7, A-6020 Innsbruck
http://www.bestsolution.at/
Reg. Nr. FN 222302s am Firmenbuchgericht Innsbruck


More information about the openjfx-dev mailing list