I am looking all over the internet and i cannot find how to disable the button in JavaFX. Maybe there is a special Property that i should be searching for and not a method? Not sure. In Swing it was intuitive to do, unlinke FX.
Any help welcomed.
26 Replies - 892 Views - Last Post: 17 February 2013 - 11:28 AM
Replies To: JavaFX 2.X disable Button.
#2
Re: JavaFX 2.X disable Button.
Posted 14 February 2013 - 11:24 AM
#3
Re: JavaFX 2.X disable Button.
Posted 14 February 2013 - 11:44 AM
Oh, boy. JavaFX may be starting to make its way here... Good catch, Ryano. It's amazing how similar to Swing JavaFX is.
#4
Re: JavaFX 2.X disable Button.
Posted 14 February 2013 - 11:51 AM
So similar, but so much better
#5
Re: JavaFX 2.X disable Button.
Posted 14 February 2013 - 12:07 PM
Thanks. I was browsing thorugh API. Must have missed it.
#6
Re: JavaFX 2.X disable Button.
Posted 14 February 2013 - 05:08 PM
#7
Re: JavaFX 2.X disable Button.
Posted 14 February 2013 - 06:08 PM
Because i was always building the GUIs with Swing, i kind of feel more comfortable with Java-like FX. Why would you say fxml is nicer than normal Java when it comes to JavaFX? Only difference i am aware of is the MVC but i am using MVC in my GUI anyway.
#8
Re: JavaFX 2.X disable Button.
Posted 15 February 2013 - 04:32 AM
It's one of those once you try it you'll like it kind of things. For example comparing some Java generation code to it's FXML counterpart, I for one much prefer the latter. It's so much cleaner, easier to read, and easier to add to in my opinion.
For me it's like the switch from WinForms to WPF in the .Net world. At first I thought 'whats going on with this new xml based gui layouts. I much prefer my old drag n drop, change attributes workflow'. But then I gave it a try, and well it's pretty darn good to say the least, and extremely powerful way of designing gui's.
From the docs. The fact that it's not compiled is a big one for me. You can make small changes to the markup and have it immediately reflect in your designer. With Swing you either have to run it to see whats happening or use the designer which has to compile it anyways.
BorderPane border = new BorderPane();
Label toppanetext = new Label("Page Title");
border.setTop(toppanetext);
Label centerpanetext = new Label ("Some data here");
border.setCenter(centerpanetext);
<BorderPane>
<top>
<Label text="Page Title"/>
</top>
<center>
<Label text="Some data here"/>
</center>
</BorderPane>
For me it's like the switch from WinForms to WPF in the .Net world. At first I thought 'whats going on with this new xml based gui layouts. I much prefer my old drag n drop, change attributes workflow'. But then I gave it a try, and well it's pretty darn good to say the least, and extremely powerful way of designing gui's.
From the docs. The fact that it's not compiled is a big one for me. You can make small changes to the markup and have it immediately reflect in your designer. With Swing you either have to run it to see whats happening or use the designer which has to compile it anyways.
Quote
Benefits of FXML
Because the scene graph is more transparent in FXML, it is easy for a development team to create and maintain a testable user interface.
FXML is not a compiled language; you do not need to recompile the code to see the changes.
The content of an FXML file can be localized as the file is read. For example, if an FXML file is loaded using the en_US locale, then it produces the string "First Name" for a label based on the following resource string:
<Label text="%firstName"/>
If the locale is changed to fr_FR and the FXML file is reloaded, then the label shows "Prénom."
The same is not true for Java code, because you must manually update the content of every element of your user interface by obtaining a reference to it and calling the appropriate setter (such as setText()).
You can use FXML with any Java Virtual Machine (JVM) language, such as Java, Scala, or Clojure.
FXML is not limited to the view portion of the MVC interface. You can construct services or tasks or domain objects, and you can use Javascript or other scripting languages in FXML. For an example of using Javascript, see Use a Scripting Language to Handle Events in the FXML tutorial of the Getting Started guide.
Because the scene graph is more transparent in FXML, it is easy for a development team to create and maintain a testable user interface.
FXML is not a compiled language; you do not need to recompile the code to see the changes.
The content of an FXML file can be localized as the file is read. For example, if an FXML file is loaded using the en_US locale, then it produces the string "First Name" for a label based on the following resource string:
<Label text="%firstName"/>
If the locale is changed to fr_FR and the FXML file is reloaded, then the label shows "Prénom."
The same is not true for Java code, because you must manually update the content of every element of your user interface by obtaining a reference to it and calling the appropriate setter (such as setText()).
You can use FXML with any Java Virtual Machine (JVM) language, such as Java, Scala, or Clojure.
FXML is not limited to the view portion of the MVC interface. You can construct services or tasks or domain objects, and you can use Javascript or other scripting languages in FXML. For an example of using Javascript, see Use a Scripting Language to Handle Events in the FXML tutorial of the Getting Started guide.
#9
Re: JavaFX 2.X disable Button.
Posted 15 February 2013 - 04:41 AM
So when you are writing GUI using fxml, do you hand code it or do you use SceneBuilder?
#10
Re: JavaFX 2.X disable Button.
Posted 15 February 2013 - 04:46 AM
So far I've just written it by hand, although I haven't yet done a huge amount of JavaFX development past the odd small app.
#11
Re: JavaFX 2.X disable Button.
Posted 15 February 2013 - 04:48 AM
The scene builder is nowhere near as good as hand coding it, but it also depends on what layout manager you use, I prefer to use MiGLayout, so I can more easily manually tweak it to exactly how I want by hand without as much fuss as using scenebuilder or anything.
#12
Re: JavaFX 2.X disable Button.
Posted 15 February 2013 - 04:51 AM
Thanks for sharing. Never used MiGLayout but heard a lot of good things about it.
#13
Re: JavaFX 2.X disable Button.
Posted 15 February 2013 - 05:04 AM
Another reason to use FXML is because using styling programmatically is actually a bit more annoying then just adding the css reference in FXML.
#14
Re: JavaFX 2.X disable Button.
Posted 15 February 2013 - 05:29 AM
I don't use scene builder either. FXML is easy. It's not retardedly complicated like Swing.
#15
Re: JavaFX 2.X disable Button.
Posted 15 February 2013 - 06:31 AM
|
|

New Topic/Question
Reply



MultiQuote






|