Re: javafx.embed.singleThread=true not working
Thanks! It’s working now without using private API. Here is the code if someone will have the same problem: package com.guigarage.masteringcontrols; import javafx.embed.swing.JFXPanel; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javax.swing.*; import java.awt.*; public class JFXPanelDemo1 { private static JButton swingButton; private static Button jfxButton; public static void main(String[] args) { final JFXPanel jfxPanel = new JFXPanel(); SwingUtilities.invokeLater(() - { JFrame swingFrame = new JFrame(Integrate JavaFX in Swing); swingFrame.getContentPane().setLayout(new BorderLayout()); swingButton = new JButton(I'm a Swing button); swingFrame.getContentPane().add(BorderLayout.NORTH, swingButton); swingButton.addActionListener((e) - { jfxButton.setDisable(!jfxButton.isDisable()); }); swingFrame.getContentPane().add(BorderLayout.CENTER, jfxPanel); jfxButton = new Button(I'm a JavaFX button); StackPane jfxPane = new StackPane(jfxButton); Scene jfxScene = new Scene(jfxPane); jfxPanel.setScene(jfxScene); jfxButton.setOnAction((e) - { swingButton.setEnabled(!swingButton.isEnabled()); }); swingFrame.setVisible(true); }); } } Am 03.02.2014 um 13:05 schrieb Artem Ananiev artem.anan...@oracle.com: Hi, Hendrik, please, try adding the following line to the very beginning of the main() method: PlatformImpl.startup(() - {}); PlatformImpl is an internal class from com.sun.javafx.application, so it is not an official way to do the job, it's just a workaround. Another option is to wrap all the code after JFXPanel.init() into additional invokeLater(). By the time when JFXPanel constructor is finished, FX has already set up single threaded event dispatching mechanism, so all the subsequent Swing events (including invokeLater() calls) are executed on the right thread. Thanks, Artem On 2/3/2014 3:16 PM, Hendrik Ebbers wrote: Hi, I’m currently trying the experimental support of the javafx.embed.singleThread flag to mix the EDT and JFX Application Thread. Therefore I created a demo application. But when I start the app the following exception is thrown: Exception in thread AWT-EventQueue-0 java.lang.IllegalStateException: Not on FX application thread; currentThread = AWT-EventQueue-0 I think I’m doing something wrong but currently I have no idea why this is not working. Any ideas? I’m using the folioing JavaFX version: java version 1.8.0-ea Java(TM) SE Runtime Environment (build 1.8.0-ea-b123) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b65, mixed mode) Here is the code of the demo application: public class JFXPanelDemo1 { private static JButton swingButton; private static Button jfxButton; public static void main(String[] args) { SwingUtilities.invokeLater(() - { JFrame swingFrame = new JFrame(Integrate JavaFX in Swing); swingFrame.getContentPane().setLayout(new BorderLayout()); swingButton = new JButton(I'm a Swing button); swingFrame.getContentPane().add(BorderLayout.NORTH, swingButton); swingButton.addActionListener((e) - { jfxButton.setDisable(!jfxButton.isDisable()); }); JFXPanel jfxPanel = new JFXPanel(); swingFrame.getContentPane().add(BorderLayout.CENTER, jfxPanel); jfxButton = new Button(I'm a JavaFX button); StackPane jfxPane = new StackPane(jfxButton); Scene jfxScene = new Scene(jfxPane); jfxPanel.setScene(jfxScene); jfxButton.setOnAction((e) - { swingButton.setEnabled(!swingButton.isEnabled()); }); swingFrame.setVisible(true); } ); } }
javafx.embed.singleThread=true not working
Hi, I’m currently trying the experimental support of the javafx.embed.singleThread flag to mix the EDT and JFX Application Thread. Therefore I created a demo application. But when I start the app the following exception is thrown: Exception in thread AWT-EventQueue-0 java.lang.IllegalStateException: Not on FX application thread; currentThread = AWT-EventQueue-0 I think I’m doing something wrong but currently I have no idea why this is not working. Any ideas? I’m using the folioing JavaFX version: java version 1.8.0-ea Java(TM) SE Runtime Environment (build 1.8.0-ea-b123) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b65, mixed mode) Here is the code of the demo application: public class JFXPanelDemo1 { private static JButton swingButton; private static Button jfxButton; public static void main(String[] args) { SwingUtilities.invokeLater(() - { JFrame swingFrame = new JFrame(Integrate JavaFX in Swing); swingFrame.getContentPane().setLayout(new BorderLayout()); swingButton = new JButton(I'm a Swing button); swingFrame.getContentPane().add(BorderLayout.NORTH, swingButton); swingButton.addActionListener((e) - { jfxButton.setDisable(!jfxButton.isDisable()); }); JFXPanel jfxPanel = new JFXPanel(); swingFrame.getContentPane().add(BorderLayout.CENTER, jfxPanel); jfxButton = new Button(I'm a JavaFX button); StackPane jfxPane = new StackPane(jfxButton); Scene jfxScene = new Scene(jfxPane); jfxPanel.setScene(jfxScene); jfxButton.setOnAction((e) - { swingButton.setEnabled(!swingButton.isEnabled()); }); swingFrame.setVisible(true); } ); } }
Re: To Be Or Not To Be (Native), was:Look and feel mechanism?
Hi, when talking about mobile LFs like iOS and Android a lot more stuff need to be done. All the mobile UIs have different layout contains and a lot of default animations. When creating a Look and Feel for mobile systems a set of additinal panes / layout containers need to be created. Hendrik Am 09.12.2013 um 10:36 schrieb Felix Bembrick felix.bembr...@gmail.com: BTW, I was wanting to refer to a comment on this topic made my Pedro DV on Twitter today. Pedro has been doing stunningly good work on a Metro Look and Feel for JavaFX and, when questioned by me, stated that while he may attempt such a Look and Feel for Android, he wouldn't try to do one for iOS for reasons which he did not completely explain. Pedro, do you mind expanding on those thoughts here? When you referred to the numerous issue with iOS were you referring to iOS itself or to trying to emulate iOS with JavaFX? Thanks, Felix On 9 December 2013 20:24, Felix Bembrick felix.bembr...@gmail.com wrote: Spoiler: This is something I have become intensely passionate about so this is likely to be a long post... OK, so this (hijacked) thread started out as a discussion of options in JavaFX for implementing Look and Feel. I think everyone agrees that even with CSS and skins, JavaFX lacks the built-in ability to define a true Look *and* Feel. Further to this, there has been discussion on Twitter and elsewhere regarding *native* Look and Feel and the merits of attempting such an animal with JavaFX. It is on this topic that I would like to add my 2 bits (as I am known to do)! I was going to use my blog http://justmy2bits.com but decided I would be much more likely to be able to engage fellow JavaFX developers in a positive, polite and respectful conversation here. First, anyone who may follow me on Twitter, in this forum or when I post in other forums (anyone?) will probably be a little bit confused as to where I actually stand on this issue. Well, this stems from the fact that I have been giving confusing (if not conflicting) input into various threads on this topic for quite a while. Why? Well, because until very recently, I myself was completely torn on the subject of native Look and Feel. In fact, I seemed to oscillate on an almost daily basis from thinking it's a great, achievable idea to dismissing such an idea on various grounds. I am swaying so much because I have so much riding on successful ports of JavaFX to iOS and Android and because those ports depend heavily on resolving this issue once and for all. Now I have had something of an epiphany and reached a conclusion. I now do not believe that pouring large (massive?) amounts of resources into the painstaking task of building a fully compliant, fully performant native Look and Feel is justifiable or worth the effort. And let's be clear about this: it is a *lot* of effort! But before I proceed I just want to say categorically how much I admire the thoroughly awesome work/efforts of the likes of Pedro DV, Claudine Zillmann, Hendrik Ebbers et. al. in (trying ever so hard) to bring native Look and Feel to various OS/platforms with JavaFX. I cannot put in words how much I am in awe of the commitment, the attention to detail, the technical prowess, the artistry and the drive of these fantastic people. Their work will undoubtedly be extremely useful to many developers worldwide. I want to make all that *perfectly clear* because now I am going to explain why I (probably) will not be one of those people and (hopefully) do it with the utmost respect for the aforementioned rock stars :-) Right, so back to the issue of whether to or not to implement or use a native Look and Feel. Some of the following comments have already been made by me on other networks and in other forums so apologies if it seems a bit repetitive to some. At first glance, the idea of a native Look and Feel seems almost like the proverbial Holy Grail. I mean, if such a thing were truly possible and viable, who wouldn't want one? You still have your single codebaseacross all platforms and you just just plug-in the particular native Look and Feel for your target platform and voila! World domination will surely soon follow! Well, not quite. It's a great idea but I am going out on a limb to claim that it has *never* worked. Ever! And by work I mean so that your not-so-native app looks and feels (which includes all aspects of behaviour, not just appearance) *exactly* like a true native app and *no one* could tell you that it *wasn't* a native app. Yes, I know there are masses now screaming at their monitors who will undoubtedly cite the numerous success stories of Swing apps or maybe even Qt or some other cross-platform UI toolkit and maybe my standards/criteria are harsher than others but I stand by my claim that this has *never ever* really, really, really worked. OK, so why not? Here's my first point
Re: JDK 8 for ARM Early Access Releases (with JavaFX)
COOL!! Am 10.07.2013 um 12:49 schrieb Tom Schindl tom.schi...@bestsolution.at: ... resending on behalf of Daniel. Original Message Subject:Fwd: Re: JDK 8 for ARM Early Access Releases (with JavaFX) Date:Wed, 10 Jul 2013 13:29:54 +0300 From:Daniel Blaukopf daniel.blauk...@oracle.com Organization:Oracle Corporation To:Tom Schindl tom.schi...@bestsolution.at Hi Tom, I can't seem to post anything to openjdk-dev today. If you are getting my mails, would you mind forwarding the notification below? Thanks, Daniel Original Message Subject:Re: JDK 8 for ARM Early Access Releases (with JavaFX) Date:Wed, 10 Jul 2013 13:20:45 +0300 From:Daniel Blaukopf daniel.blauk...@oracle.com Organization:Oracle Corporation To:openjfx-dev@openjdk.java.net CC:Tom Schindl tom.schi...@bestsolution.at My mail content keeps getting stripped out by the list server. Maybe this time it will work: JDK 8 for ARM hard float is now part of the regular JDK 8 Early Access releases. You can get it at https://jdk8.java.net/download.html; this page will be regularly updated with new builds. As in the previous Early Access release, this includes JavaFX for the Raspberry Pi. Daniel On 07/10/2013 01:04 PM, Tom Schindl wrote: Hi, Any url on this? Tom On 10.07.13 11:08, Daniel Blaukopf wrote: