JavaFX Script and Java - java

Simple question: Can I mix in my desktop application Java and JavaFX Script code? If it is possible could you provide me with some link with examples?
Or could I pack my custom made javafx CustomNode-s in a jar and use them in my project side by side with standard SWING components?

This article gives an example of calling JavaFX from Java, using the Scripting API.

Yes, you can mix Java and JavaFX.
According to one of the FAQ entries:
In addition, developers can use any Java library in their JavaFX applications. This allows JavaFX applications to take advantage of the rich JavaFX UI libraries, as well as the amazing breadth of functionality offered by Java.
The official source of information, including tools downloads, FAQ, and tutorials is the JavaFX web site.

I suggest you to look at dotFX. It can be useful for you. It has a netbeans plugin,too.
Read first here for get more information.

You can use a JavaFX 2.0 with Swing
http://javafx.com/about-javafx/
If you install the JavaFX 2.0 runtime first, then you launch an example http://download.oracle.com/otndocs/products/javafx/samples/SwingInterop/index.html

Supposedly all you have to do is drag and drop the JavaFX application to your desktop in order to make it a desktop application. You can also use Java code in a JavaFX application. Not sure about the other way around.

Yes Javafx and java apis can be mixed and used in your application without any problems.

Related

Can JavaFX be included on a Java SE project?

I'm trying to create an Inventory project and have graphs on it. I'd like the graph to be created thru JavaFX and call it on a Java main class. Is it possible to add a JavaFX class to a Java project?
I'm using netbeans btw.
JavaFX for Java 7 is different from JavaFX on Java 8. My advice would be to go for Java 8. Then maybe NetBeans 8 too. JavaFX and swing/awt have different event threads, though under java 8 there seems to be a better integration.
JavaFX and java swing are two separate worlds. One might embed JavaFX in swing. Though if you are at the start of a basically new project, then you might go for pure JavaFX.
JavaFX uses "properties", wrapped values that can have change listeners on them / data binding. This separation from components makes dealing with the Model-View-Controller paradigm a bit nicer / different. JavaFX components themselves are a slightly more difficult, as swing provides a full API full of setters. It can be hard to make a column right-aligned for the first time. Another thing that makes JavaFX harder, is the use of callbacks with generic types, lambda expressions. Giving the correct signature not always is straight-forward.
So embedding JavaFX in swing might be a good approach if there is much swing experience or existing code: see
Embediing Swing in JavaFX (the other way around) and
How to Use JavaFX in Your Swing Application
If you mean, you have a NetBeans 7 Richt Client Application, then on the NetBeans.org there several small articles on JavaFX integration.

Run netbeans java project in browser

How is it possible, to run netbeans project in the browser?
My project have only one frame, and uses swing. I have no idea, how is it possible, to write an embedded java application, for browsers.
You are looking for Java WebStart , take a look to this tutorial in Enabling Java Web Start in Netbeans.
More information Lesson: Java Web Start
Also you may interested in Applets, Lesson: Java Applets
Consider looking into JApplets, this sounds to be what you are looking for.
Links:
Example
Documentation
I think if you want to launch it in Browser then it is better in Netbeans you chose Java EE project. This you can run in browser and you can create much better GUI than swing by using HTML and CSS. Of course it will be applet based.
Check this tutorial

Desktop GUI framework

I tried to create a new Swing GUI desktop application template using NetBean 7.0 and just found NetBean has a disclaimer:
"Note that JSR-296 (Swing Application Framework) is no longer developed and will not become part of the official Java Development Kit as was originally planned. You can still use the Swing Application Framework library as it is, but no further development is expected."
So does it mean swing will stay the same from now on and nothing new will be added? What will that impact the applications using Swing? Do I need to consider other GUI frameworks instead? What would be the best framework option for a scientific plotting and graphic heavy application?
Thanks.
Swing is part of JAVA since 1.2 and it is part of the JAVA STANDARD. It is not going anywhere any time soon.
The JSR-296 (Swing Application Framework) was a framework to simplify and help developing in swing, which didnt go very far. Netbeans uses it internally. If using JAVA 7 then, like many other netbeans specific libraries, you need to ship it separately with you app, because it is not standard.
So, feel free to develop in swing. A pure swing app WILL WORK on any JAVA STANDARD on almost any platform for a long time to come. If you use the SAF, thats also OK, but that is not standard and its pretty much dead, so just remember to ship the jar with your app.
Hope that clarifies the situation.

frontend application in java

can we develop java frontend application just like we do in WPF? that runs on windows platform?
Of course, just use Swing or SWT.
of course you can use java also for frontend applications, those applications will require the java VM and will probably run in some platforms not only windows, this in general then depends on the details of your specific application.
Said so, I am not aware of libraries available in the Java world which would let you compose rich and advanced user interface like you can do with WPF.
Of course, Java can be used to create front-end applications that run not only on Windows, but on any operating system that has Java installed on it.
To create front-end GUIs, you could use either AWT(very old, not recommended), Swing or SWT(the latest addition to the Java GUI library by IBM).
XUI is an XML-based frontend development toolset for Java.
If you're looking for a ClickOnce equivalent, Java Web Start would be appropriate.
There are several GUI toolkits out there (as already mentioned by others), but they only provide the basic building blocks. (WPF also falls in this category, AFAIK.)
I recommend to build GUI application on top of a modular Rich Client Platform (RCP) such as the NetBeans Platform (Swing-based) or Eclipse RCP (SWT-based).
Here some links for the NetBeans Platform:
http://platform.netbeans.org/
http://netbeans.org/features/platform/features.html
http://netbeans.org/features/platform/all-docs.html
There´s a technology for desktop frontends from ADOBE called Adobe AIR.
It´s similar to WPF (it uses a variation of XML, in this case MXML), and has several rich components and effects!
Try it out at http://get.adobe.com/air/

Is Java Swing out of date?

I downloaded Net Beans IDE and created a new desktop aplication. I choose it to be Swing app. The IDE displayed that the Swing framework is out of date and will not be supported in the future.
Does this mean that Swing is out of date? And if so what are the most recent frameworks that can be used to develop desktop applications?
thanks
In NetBeans the Desktop Application project type is a project based on an external library that was supposed to be the Swing Application Framework (which does things like session state of GUI controls and resource bundle management) but never matured. So that project type is outdated.
However Swing itself (the GUI platform) is `current' in the sense that it is the foremost GUI toolkit that Java has and will continue to have for some time.
The Swing Application Framework (JSR296) was a project intended to extract the common elements for developing applications with Swing. It is safe to use but is no longer being developed. The official page https://appframework.dev.java.net/ suggests a couple of alternatives, including using the netbeans platform itself and, given how greatly netbeans has matured, I would be keen to investigate this approach.
Swing itself is fine, it'll be around as long as Java is. Though in saying that desktop Java has never really taken hold in the same way other flavours have.
AFAIK Swing is definitelly not out of date and will be even enhanced in JDK7
Maybe you should show us screenshot, it might be misunderstanding
I think something wrong with your netbeans. Can you show some screenshot?
The future of swing

Categories