I'm trying to learn JavaFX 2.0 + FXML, and i found it kind of uncomfortable to make fxml file, without knowing what i can put in it and what i can't. I mean which tags are possible in FXML, which attributes evety tag has? which values evety attribute can have, and so on.
There are some examples in a web, but they don't show the hole capabilities of FXML.
I've tried to use NetBeans and Eclipse plugins for JavaFX 2.0, but, both of them does not have any intelences for FXML, they just validate open-close tags and other simple things, which evety XML editor can do. Maybe i've configured these plugins wrongly.
So, is there any documentatin with full reference (all tags, attributes and its possible values) of FXML?
FXML Reference
Introduction to FXML describes the syntax and usage patterns of the markup and is important to study when learning FXML. It does not define all elements usable in FXML.
There will never be a full reference (nor xml schema) for FXML as it works by reflecting on Java classes in the classpath and defining elements and attributes based on the properties of the classes.
FXML's creator (Greg Brown) suggests:
So currently Javadoc is the best reference.
For future Javadoc revisions of JavaFX, the JavaFX team is considering including FXML examples in the Javadoc.
This forum thread and this forum thread contains discussions about and links to fxml documentation.
FXML code completion in IDEs
NetBeans 7.3 provides FXML code completion.
The defacto JavaFX eclipse plugin e(fx)clipse provides FXML code completion.
Intellij Idea 12.1 provides FXML code completion.
These IDE inference engines work by reflecting on Java classes the same way the FXML implementation does.
When you use a library like ControlsFX, or develop your own JavaFX components, the IDE code completion is able to make use of the new classes and attributes you have created or linked.
To keep the answer updated here is the Javadoc for Javafx 8.
Related
Summary
We are developing FXML with Scene Builder 10 and loading it on an app with JRE 8. We are confident that our FXML is all Java 8 compliant, but would like to suppress the following warnings that are printed whenever an FXML file is loaded:
Dec 19, 2018 12:50:14 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 10.0.1 by JavaFX runtime of version 8.0.192
We've thought of a variety of solutions, but none of them seem very good. I just want to know if anyone can think of anything better.
Note that there are a few questions on SO that seem very similar to this, but so far it seems like they were all resolved by just updating to a newer JRE, which is not an option for us.
Background
Our apps get shipped to a variety of customers, some of whom are unwilling to update past JRE 8. It turns out that Scene Builder for java 10 is WAY faster than Scene Builder for Java 8 (not sure why). As a result, we'd like to keep using Scene Builder for Java 10, but we always write our code to be Java 8 compliant and we always do all of our testing with JRE 8.
Workarounds
There are a variety of workarounds we've thought of, but they all seem a little hacky and definitely more like workarounds than true solutions. What I would really like to see would be either a way to tell Scene Builder to use an older API version, or to tell the FXML loader to ignore the version number. It's looking like that's probably not possible though.
Manually change the version number in FXML
It's not hard to just change the xmlns="http://javafx.com/javafx/10.0.1" attribute to xmlns="http://javafx.com/javafx/8.0.192" but it gets updated every time you modify it in Scene Builder and it's a pain to have to keep changing it. I thought about making a git hook to do it automatically on commit, but we're using Eclipse and the egit hook integration is practically non-existent.
Redirect Stderr on FXML load
We could make an FXMLLoading utility that we use for all FXML loading. It would could essentially disable stderr prior to loading it and then reenable it. This would not be thread safe though and anything else that might be printed to stderr at the same time would be lost.
We could also redirect stderr to an object that determines what should be printed based on the currently running thread, or perhaps by just omitting text that matches the FXML warning we're seeing. This still seems sort of hacky though.
Use custom input stream to load FXML
We could create an FXML loading utility that uses load(InputStream) and pass it in a custom InputStream that filters out or modifies that xmlns attribute. I think that this is probably my favorite solution, but it still seems like sort of a hassle.
I'm returning to Qt programming after an absence of a couple of years, and I'm starting with Qt 5.1. In the past, I've used the designer, and a good deal of hand-crafted code to put Qt projects together. Now, we'd like to make heavy use of the Creator.
But I'm not seeing how to accomplish some seemingly basic tasks. For example, I'd like to design a custom widget, then pull it into my main application, but although the Creator allows me to make multiple files within a project, they seem to have no knowledge of one another as far as the Creator itself is concerned. Once my widget is built, there's no way to pull it into the main application, and also no way to test it independently, at least that I'm able to find.
It seems as though documentation for Qt has taken a major blow somewhere along the line. It is cursory and thin, compared to the extremely detailed docs that used to be available in the past.
If someone can point me to a decent collection of documentation and tutorials, I would be grateful.
Unit Testing
Use the Qt Test module: https://doc.qt.io/qt-5/qttest-index.html
Using Custom Widgets
I'm not 100% sure what you meant by "pull [the widget] into the main application".
If you want to combine your custom widgets in Qt Designer, add a placeholder (blank) QWidget in the parent and Promote it to your custom widget:
https://doc.qt.io/qt-5/designer-using-custom-widgets.html#promoting-widgets
If you want to combine your custom widgets in C++, instantiate your custom child widget and add it into the parent widget's layout using QLayout::addWidget():
https://doc.qt.io/qt-5/qlayout.html#addWidget
If you want to make your application display a custom widget, simply #include the widget's header, instantiate the widget, and call QWidget::show():
https://doc.qt.io/qt-5/qwidget.html#show
If you want to develop your custom widget in a separate standalone project, include it in your main project as a Subproject:
https://doc.qt.io/qtcreator/creator-project-creating.html#adding-subprojects-to-projects
How do I make a subproject with Qt?
Other Notes
Qt Designer has been integrated into Qt Creator for many years. Qt Designer and its documentation have changed very little between Qt 4.8 and Qt 5.
The extremely detailed docs for Qt 5 are at https://doc.qt.io/qt-5/. There are links to useful doc collections in the nav bar on the right.
I recommend exploring QML/Qt Quick. It's much easier to create QML-based GUIs compared to widget-based GUIs. It's still a young technology though, so it might not suit your needs yet: http://doc.qt.io/qt-5/qmlapplications.html
Recently i switched my GuI and programming to fit Javafx and use the new JavaFx scene builder! These new tools (atleast new for me) has opened alot of doors when it comes to creating user interfaces and i want to learn more and get better at it. Therefore i wish to learn CSS for JavaFx.
So far i have been unable to find any online tutorials for beginners and because of this I want to ask you guys; do you know any sites, books or video tutorials where i can learn to write CSS for JavaFx projects?
For learnIng JavaFX CSS, work through the following tutorials:
The JavaFX Getting Started tutorial on CSS.
The JavaFX CSS tutorial.
When using SceneBuilder, review:
Using a Style Sheet in SceneBuilder.
SceneBuilder Style Sheet Support.
When developing your own apps, the two most useful resources are:
The JavaFX CSS Reference Guide.
The (essential) JavaFX 2.2 Caspian Style Sheet which contains the default styling for all JavaFX controls.
If you search the web you will find many resources on CSS and HTML. Be careful using these resources. JavaFX CSS is not the same as the CSS you use to style a web page. While the file format is the same, JavaFX CSS has it's own set of attributes and allowed values, includes few layout processing specifiers, uses it's own syntax for effect processing, background and border specifications, etc.
You might easily find many good resources simply by Googling.
Here are recommended ones
MDN
www.w3.org
Note:Stay away from w3schools.com.
Reason to avoid w3schools
The best way to learn CSS would be to learn it by doing.
Create some web pages and style them no your own.
Hi Does any one tell me what is [Event(name="change", type="flash.events.Event")] this?
I'm using ActionScript 3.0 in Adobe Flash IDE.
In Flash Builder, the metadata is used for ASDocs and code hinting. It means that the component/class which has that data may dispatch an event named "Change" which has class type of "flash.events.Event".
It could be considered a developer helper. It isn't required, but it makes things a bit easier for other developers using your class.
More info on Metadata.
I couldn't find any metadata tag documentation on Flash Pro or AS3. But, here is a blog post that covers some stuff.
I have been in the process of creating a "lite" version of an existing Flex application, and thereby porting many of the classes that are used by both into a library project. As such, I want to easily find all of the "orphan" classes in the original project - those classes that are no longer referenced/used by the project. Is there an Eclipse plug-in, or some other easy way to find these in Flex Builder 3?
Thanks.
MXML Compiler (mxmlc) compiler has "link-report" which will generate all the classes you are using in your original application. From there, with a bit of grep / awk / xsl magic, you should be able to diff with the classes you have in your library project.
Here's what I do sometimes, lets say we've been refactoring, and a class becomes obsolete, I simply move the suspecting file from Flex Builder to the desktop, rebuild the project and see if it the compiler spits out any Errors.
If it doesn't complain, I know I can safely delete it.
If your class is depended on, the compiler will throw some errors in the Problems panel in Flex Builder and give you a fairly clear hint of what's missing.
This won't be fun however if you have thousands of classes, as you have to traverse them one by one.
I would suggest, always keep copies of the old ones in Subversion, just in case you had something re-usable in there, and later you want the deleted file restored.