I saw some other similar questions on this topic here but they were not very helpful so I a posing this question.
What is the fastest way to convert a reasonably sized, simple web app to a Java desk top based client targeted for pc and mac? Unfortunately I can not share a whole lot of details about the app here due to various reasons. The most complicated UI in the app though is a page that contains a multi level threaded discussions (please see here for an illustrative example of what I am talking about.) The current web app is based on python so I can not re use anything from the server side code (dont think this is an issue)
I have never done any swing or awt or any other Java based thick client GUI work. My thinking is more or less defined by web based applications. I am capable of doing end to end web app development (including backend and decent UI using HTML, CSS and JS) using Java or python. For your answers please focus on Java solutions only.
So here are my questions
What is the best framework or tool I should use? I found some of the following tools on the web as part of my research.
Awt - does not look like this is a good choice.
Swing which I believe is bundled with regular Java SDK/JRE. - This may be my best
bet.
SWT which seems to compliment Swing in some fashion.
Griffon based on an article here. This framework uses Groovy ( I
have no clue about Groovy, btw) Adobe Air flex. Any open source
frameworks?
What are some of the other issues that I need to keep in mind? Some that I would like your comments on are:
How does the fact that it needs to be deployed on the client complicates things? Since we are using Java, I believe this to be a non issue. I am aware of the usual trade offs between a web based app and a desktop app (e.g. ease of deployment and upgrades etc etc.)
How easy is it to create a one click installer and bundle the app and the environment needed - eg. JRE etc?
The product needs to work on Mac and Windows. Does that complicate things in any way (Again, since it is Java I am assuming there are no gotchas but would like to be forewarned if there are any)
What is the framework or technology that may be good to have on the resume as a skill set?
My deadline is a max of 2 months - would that be enough for a reasonably simple web app given that I need to learn all of these technologies? I am just trying to get a sense here - I know it is most likely impossible to give an accurate answer - just assume I am smart enough and can pick up any unfamiliar tech stack fast enough.
Thank you!
GUI toolkit
Given "Mac and Windows", I'd say that settles my recommendation as "Swing" (perhaps with SwingX1).
I agree with your assessment of AWT. It does not support formatted text in any component out-of-the-box. It also lacks trees, tables (and other components) & people with recent experience using it. Note though, that it is also "bundled with regular Java SDK/JRE" just like Swing, it is just that it is older and less enabled than Swing generally.
If anything complements Swing it would be SwingX. SwingX is built on Swing and provides advanced controls that are not available 'out of the box' in the J2SE.
Swing and SWT are mutually incompatible - use one or the other.
I have no experience with Griffon.
Swing is the most used of the options outlined, so for getting help (ignoring other potentially important factors in the decision), it would be a good choice.
Note 1) Add SwingX if they have any groovy components that present threaded conversations easily, but I suspect a JTextPane would suffice.
Deployment
As far as deployment goes, that is a little more tricky than it seems. Many desktop computers do not come with Java as standard. Those that already have it, might have an old version.
To ensure a JRE of the right minimum version to run the app. is available, use the deployJava.js (mentioned, with links, in the JWS page below).
To provide a 'one click' launch experience for the user, look to Java Web Start.
Cross-platform gotcha's
Unfortunately, though Java is x-plat, there are plenty of things that programmers can do that stuff that up. E.G.
Not accounting for the platform default:
File encoding (file.encoding2)
Line break (line.separator2)
File separator (file.separator2)
Coding fixed size ('absolute layout') apps. that will be shown as different sized apps. on other OS.
...
Note 2. That is showing the property to use for each.
Timetable
Obviously I cannot speak for you, but I can tell you that I would have had no chance of going from 'which technology' to a 'deployable app' within two months.
Hope you're more capable than me! ;)
You said that you wanted a Java solution, but be aware that there are plenty of Gui options in Python, and you already have your web application written in Python.
Groovy is a different programming language than Java, but Groovy runs on the JVM. Do you want a Java solution or a JVM solution? I ask because you mention Griffon.
Assuming you want Java, I think your main options are Swing, SWT, JavaFX 2, and Apache Pivot. Oracle has said that they intend for JavaFX to replace Swing as the GUI platform of choice. That said, JavaFX 2 is in its infancy, and only a preview release is available for Mac right now. The upshot of JavaFX and Apache Pivot is that you could use the same code for your web application as your desktop application.
You can try doing so in small steps:
* As a first step you can create an applications with SWT and embed your application in a browser control.
* Then you should move pages and some controls from the web app to the desktop one by one.
In this way you can get a minimal application in hours :)
P.S. If you want an iOS app with this approach it's worth looking at this open source project: http://en.wikipedia.org/wiki/PhoneGap
Related
There are a lot of Java "application frameworks" such as those listed in http://pivot.apache.org/demos/ which pretty much all use Swing as the GUI toolkit, or in the case of Eclipse, SWT.
However I have not seen any obvious frameworks for JavaFX. Why is this?
If looking at the "Hollywood Principle", where the framework calls you, I would think JavaFX already does this, but then I'm confused because it would seem Swing and JavaFX do mostly the same role, which is as the GUI layer. But they both do event loops and callbacks/events/observer patterns, etc.
Does merely implementing an event loop and calling your event handler not qualify as an "application framework"?
If not, are there any frameworks based on JavaFX directly (rather than embedding JavaFX in a Swing control)? What would such a framework provide that JavaFX standalone does not?
Sorry for the "obviousness" of this question, but it's not obvious to me.
thanks.
There are plenty of them looks like your research has not been very thorough
http://efxclipse.org/ - in fact it leverages the same core stuff than the Eclipse 4 IDE / RCP 4 but replaces the SWT layer with JavaFX
http://www.jrebirth.org/
http://www.drombler.org/drombler-fx/
http://jacpfx.org/
As I'm the author of e(fx)clipse I'm biased but I know first hand that it is used on (big) commercial projects
In my opinion, Swing, JavaFX and also SWT are graphical toolkit, providing a set of basic widgets. There are not "Application" frameworks because their main goal is to display an User Interface. But you can use them to build an application without any other library by using basic features.
A good sample application can be found here: https://github.com/angelicalleite/museuid
It looks really nice with data picked from a mysql database, but if you read carefully the source code you can notice that all SQL queries are performed within the UI thread which will slow down the UI responsiveness.
This is one of the reason you should use an Application Framework.
Their goals vary and are numerous but they all are dedicated to ease your application development by keeping complex things (like multithreading, messaging) out of your application code.
Your choice shall be done according to your personal convictions about architecture and dependencies you want to use (or don't).
I'm the author of JRebirth (disclaimer), but I sometimes have a look on other frameworks, so you can make your choice by asking yourself some basic questions:
Do you want/need OSGI support ?
=> Yes efxclipse, DromblerFX, DEMUX
=> No JRebirth,JacpFX, DataFX, griffonFX, afterburner.fx
Do you want a minimalist framework?
=> Yes afterburner.fx
Do you want/need event messaging?
Do you want to share code?
Do you want modularization?
Do you require Java 7 support ?
How do you want to manage your application threads.
I certainly forget a lot of questions.
In fact you SHOULD use one of these Application Framework (building your own will be time-consuming), it will defintely speed up your developments and secure them, the remaining questions are :
What AF will fit your needs ?
What AF will be convenient to use for you and your team ?
Choosing an AF using patterns you don't like could be painful, in any case you can contribute to any available AF because they are all open sourced.
Hope it helps,
The simple answer to this is: JavaFX is much younger than Swing - at least as a standard JDK library. As a matter of fact, it only became a "real" standard part with Java 8. If you check the history, you see the following facts:
Before JavaFX 2 (released 2011), developers needed to learn a scripting language.
Also before JavaFX 2, the implementation aimed at being platform independent and therefore made no use of system-specific resources which can make a big difference in graphics and animation.
Read through it, and you'll find some more interesting details which can be summed up in that probably most developers have only been "seriously" noticing JavaFX within the last 5 years or so. Swing goes back much further (especially as being baked into the standard Java Runtime Environment), so naturally there are far more libraries aimed at Swing than at FX.
I need an advice for cross-platform engine/framework for desktop PC application development (Windows, MAC, Linux). I see 3 possibilities, Qt, Java and Adobe AIR.
It must be easy to install (run-time is a drawback, but C++ wrapper and/or installer can solve the issue I think).
It must be fast and have a rich GUI (not 3D game, but definitely some 2D graphics).
The development environment must be easy to establish and the UI development tool must have drag&drop functionality to define application layout.
Target application must have native look and feel. The professional paid support should be available.
All of these criteria are met by Qt, with the exception of "native look and feel". There is no such thing as a cross-platform framework with native feel, especially on OS X, where users are very demanding about the "feel" of applications. If you really want native look and feel, you are best served by writing a shared framework in C++ or C# and then providing native GUI on each platform (you can use MonoMac to provide a native Cocoa UI using C# instead of the native Objective-C, if that's your cup of tea).
That said, we've been very happy with Qt (and the Commercial support) for cross-platform development. Particularly the new OpenGL accelerated 2D Scene API makes animated UIs quite easy. QtCreator is a decent IDE with visual designer support.
Contrary to others, probably due to the fact that I worked on a real-time trading Swing application, I consider Java to be the best answer to your requirements (however, i consider this question as subjective, as previous answers already shows). Let me develop.
It must be easy to install (run-time is a drawback, but C++ wrapper and/or installer can solve the issue I think).
Using Java, you can rely upon Java Web Start, which is, as far as i know, the best solution for easy to use applications : you click a link on the browser, and the application is installed in start menu/desktop and started as soon as it is downloaded. Seems like Adobe AIR offers an equivalent feature, but to my mind Java Web Start integrates, due to the deepness of its ecosystem, far more powerfull distribution solutions (like, as an example, the easy ability to generate the .jnlp file on demand).
It must be fast and have a rich GUI (not 3D game, but definitely some 2D graphics).
Contrary to most popular belief, generating good graphics in Java is possible. Take as an example a look at excellent filthy rich clients companion site of the excellent book.
The development environment must be easy to establish and the UI development tool must have drag&drop functionality to define application layout.
Eclipse is a defacto industry standard for IDEs, and it integrate multiple DnD IDE builders. I would simply take as example the recently liberated Windows Builder Pro.
Target application must have native look and feel. The professional paid support should be available.
Well, Swing default look'n'feel is indeed a little different from system one. however, there are excellent third-party ones, listed here, as an example.
Finally, some examples :
the excellent Palantir Technologies blog list some outstanding Swing applications
Gephi is a rather complete and efficient high-volume graph viewer
My previous work (don't consider it as a masked ad, it's only a way to show some rather solid Swing).
I would not recommend Java for desktop development. I do not care what other say, Java is still slow compared to native languages like C++. I would go with Qt. The IDE has a GUI builder and can be integrated into Eclipse or Visual Studio.
Here's a helpful resource:
http://qt.nokia.com/products/
Have a look at Appcelerator Titanium: it basically wraps a web app in a browser. You can have anything you want in a GUI using wen tech, but it looks like an ap[p.
Strangely, nobody mentioned Real Studio (now Xojo) which does meet all your requirements:
It is easy to install and does not require a separate run-time
It compiles to native code so is reasonably fast
It has a good UI library that is native for each platform
The IDE is very nice with drag and drop UI designers
Target applications are fully native and use native controls
First of have to mention http://wxwidgets.org/ , one of the most popular X-platoform frameoworks. Depending on the complexity of your application and the requirements to the "nativeness", a cross-platform framework may work for you. The x-platform applications built with framework usually feel a bit "alien", especially on the Mac, but workable. A good example is http://taskcoach.org/.
If your users are tolerant to hearty download sizes, hefty memory requirements and a bit of non-native look-and-feel then plain Java, eclipse RCP or NetBeans platform can work for you. You may save quite a bit of development time going this route.
However I am not aware of cross-platform framework that satisfies all your requirements.
If you need to get to a production-level application, the strategy that I have seen worked best was to stay native but split the UI-dependent code into cross-platform (e.g. C++ business logic) and UI. This way, you will use native interface building tools (each platform has something good there). Depending on the complexity and "finish" requirements of your application you may actually save time going this route.
A great overview of the "Native X-Platform" process can be found in this answer by Chris Hanson.
I am interested to widen my horizons and wish to learn what are the options for developing a powerful browser hosted UI in Java. All I know is .NET based solutions, specifically Silverlight, which I find extremely powerful, although not without some regretful omissions as compared to its elder brother - WPF.
So, to rephrase my question. Are there mature Silverlight alternatives in Java?
Thanks.
P.S.
I am not starting the war of Java vs .NET, so please do not raise the benefits of Java against .NET in general. I am interested in a specific area only, anything else is put aside.
Please, do not bring Adobe AIR, flex, HTML5, etc... The questions is about Java.
The question is about Java, but front-ends for the web are almost never written in pure Java.
GWT - that's where you write pure Java which is then translated to javascript and html automatically
JSF - you reuse rich components to create your pages. Still there's html and javascript. This resembles the ASP.NET model
Vaadin - heard of it, never used it. Seems promising
ZK - Same as above.
jQuery - yes, this has nothing to do with Java, but is very powerful tool for creating rich UI
Flex - easy integration with Java back-ends. (I personally don't like Flex, but it's a viable option)
(I specifically omitted JavaFX, because in my opinion it is not yet mature)
You know, having rich applications in the browser using Java has existed since, say, 1999 : applets, that's what they're for.
They were long far from beautiful. However, with the recent apparition of JavaFX, they can now have a very nice look.
The closest thing to Silverlight in the Java world is JavaFX. I haven't worked with it myself though, and I don't think I've randomly come across any sites using it in the wild... which means your users are less likely to have whatever plugin is required... and you're likely to be cutting out most mobile users too. (I believe there's a mobile flavour of JavaFX, or at least one planned, but you really want to find out whether it exists on iPhone/Android/(whatever your target market is).
Personally I would probably try to stick to HTML 5 and JavaScript, which can still be pretty rich. (That doesn't necessarily mean writing all the UI by hand, of course - projects like GWT and jQuery are your friends.)
Open Laszlo is worth a look they have a nice interactive demo section too.
The OpenLaszlo platform consists of the LZX programming language and the OpenLaszlo Server:
LZX is an XML and JavaScript description language similar in spirit to XUL, MXML, and XAML. LZX enables a declarative, text-based development process that supports rapid prototyping and software development best practices. It is designed to be familiar to traditional web application developers who are familiar with HTML and Javascript.
The OpenLaszlo Server is a Java servlet that compiles LZX applications into executable binaries for targeted run-time environments.
I'm not sure if it fits your demand but have you looked at the Google Web Toolkit? It compiles Java to javascript and some colleges have made nice UI's with it.
I've used GWT before and more recently Vaadin which I would recommend. You can give it a go at a demo sampler here. I am currently using it to create custom portlets for the Liferay CMS/Portal and I am pretty happy with it.
Is it possible to develop an application easily available on the web that also can be distributed on DVD (installer or started from the dvd)?
For the moment, we use static html (frameset!) pages (generated by xml files), with one difference: pdf's are only on the DVD version, the web version only shows a preview of these files.
Can this be done with JavaFX, OpenLaszlo or are there better options?
(for example: turbogears, and using tg2exe for DVD version)
I think if you design it correctly to begin with, a JavaFX app can be interchanged between web-app and desktop-app relatively easily. However, I've only done this with very simple apps (specifically, Tic-Tac-Toe!), so I'm sure there might exist some caveats that I am unaware of (thus the "design it correctly" catch-all). ;)
Why don't you just provide the PDFs in your current web version, rather than redeveloping everything? I'm not aware of any browsers that don't support in-browser PDF reading anymore.
Yes JavaFX or Flash applications can be used to develop applications that run in different contexts.
However, it's not clear from your question why these would be preferable over your current solution.
If the information your sharing is primarily text and you're using DVD because your audience is primarily located in area with bad Internet connectivity, then you're current approach probably makes more sense. JavaFX or Flash might be more fun to write for developers but maybe doesn't serve your audience.
I would suggest that if you are shipping DVD and are looking for ways to make the DVD more useful than as a PDF delivery system would be to add video to the DVDs. And then maybe it would make more sense to use JavaFX or Flash to drive the UI.
Yes, it is possible. If you use JavaFX you will be allowed use multiple deployments. For example, NetBeans 6.7.1 with JavaFX creates several possible deployments from one project. Then you can publish this application on web, DVD, etc. You will need to slightly customize standalone deployment for DVD to be able e.g. start it as autorun if necessary. JavaFX is good choice.
This seems like a job for flex, however I know better little about it to give a better answer.
A few years ago client Java was unsuitable for web development because a remarkable part of web users did not have Java installed. ( I don't remember exact numbers, more than 10%).
Now I see the Google Analytics stats for a big site and it tells that >98% of users have Java installed.
Is these stats very biased by Javascript usage? As I understand Google Analytics measure only users that has Javascript.
Is the picture similar on other big sites?
Does client Java have really "stopper" drawbacks compared to Flash?
EDIT: I mean java applets mainly, java WebStart seems to be not suitable for average user.
I mention Javascript only to describe the way Google Analytics works.
When I wrote my diploma project, I had to choose between Flash and Java Applets. Here are some pros and cons:
Java Applets:
[plus] you program in Java, which is mature and stable
[plus] you can use the Java GUI frameworks that pack a lot of punch
[minus] the first time the user hits the page with the applet, the JVM must be initialized and this can take up to a few minutes even on a fast computer
[minus] Applets are not meant to be used as animation media; sure, you can do stuff, but it is like programming in C - you do everything from scratch
example: i needed to show a data packet as it moved between two routers. The packet must be a control of some sort, like a button or smth. This animation can be defined in 1 line of code in Flash, where all objects derive from some base object that can be animated. I could not find a suitable solution in Java.
Flash:
[plus] really really focused on animations;
[plus] ActionScript is actually an OO language
[minus] ActionScript is sloppy, bughish and has only a few supporters. If you are stuck, be prepared to search obscure Japanese forums for solutions
[minus] ActionSCript may be OO, but it lacks a lot of features, like Enums, fully fledged interfaces, threads (!!!!) etc.
[minus] Flash was designed to be used by non-tech people - they just use the authoring tool; I wrote code for everything and it worked, but it was a pain.
My conclusion:
I eagerly await a programming paradigm for animations and rich client interfaces.
ps: Silverlight seems to be a disappointment so far, maybe Microsoft will inject some $ into it.
Mmm, Java seems to be better supported than I though, I searched some stats and found between 92 and 96% of browsers support Java (ie. it is enabled enough to detect it! although I guess lot of Java detection algorithms use JavaScript to detect & report - as you point out - but JS support is very good too anyway, even more in our Web 2.0 era).
Adobe boasts better support, but overall the difference is rather marginal. Anyway, somebody really wanting to see/use the application will activate/upgrade/download the needed engine.
Now, we have to see what JRE is supported! Alas, I didn't found any stat for that.
There, Adobe have an edge: not everybody have Flash 9 or 10, but upgrading is quite fast. While downloading and installing a new JRE is quite a bigger task... Of course, you can target the historical lowest common denominator Java 1.1, or more realistically Java 2 (1.4), but it is still frustrating not to be able to use all 1.6 features...
I have seen some people complaining that Java applets crashes their browser (apparently on Unix systems) but it is more an issue with a minor number of browsers/systems than anything else.
And as pointed out, startup time of a Java applet is quite longer than for Flash (although some big Flash games are slow to load too).
Now, I have seen a number of Processing applets, like the notorious Webpages as graphs, most of them load quickly: lot of the power is already on the hard disk of the user, in the extensive Java library. Processing generates quite lightweight jars, while lot of Flash applets must include foreign libraries... or reinvent the wheel!
Some previous postings are obsolete in regard to comments on ActionScript. ActionScript3. became available in the Flex 2 time frame, i.e., January 2007 when Flex 2.0 and Flash player 9 shipped.
AS3 is a full blown OOP programming language comparable to Java. It has classes and interfaces, inheritance, access protection keywords for class members, constructors, statics, plus some nice things that Java doesn't have: properties, events, declarative data-binding, and closures.
By default AS3 is statically compiled, hence one declares the type of members and variables. This can be relaxed to where AS3 can revert back to dynamic typing ala JavaScript. It is less efficient at runtime, though. Sometimes when dealing dynamic data it is none-the-less useful to selectively employ dynamic classes. (A nice benefit of static type checked language is code completion in the Flex Builder IDE.)
Much of Flex development is accomplished using MXML. This is a declarative XML-based DSL for Flex. MXML gets compiled into ActionScript3 code, though. So what you do in MXML is equivalent to AS3 imperative coding, but can often be more concise, clearer, and more appropriately structured with respect to the underlying graphical Flex form it represents (i.e., MXML is good for coding the views of the MVC pattern).
The bottom line is that ActionScript3 programming of Flex is easy and natural for a Java or C# programmer to learn. The language is not at all the issue. The power of Flex comes in becoming intimate with the Flex SDK and the myriad capabilities found there.
Not an exact answer, as it would be very opinionated, just sharing my experience...
In a recent project, where we were building a WAI compliant site, we were asked to avoid flash objects as accessiblity was a major issue. Applets on a different note don't go very well with most web developers ;). One reason might be the differences in the paradigms of Rich UI vs. web UI.
However, we found applets to be irreplaceable (not speaking for .NET and ActiveX controls) when client side monitoring was needed. The application uses SmartCard based authentication and applets are loaded into browser to listen for client side events (card removal) and alert the server to end session.
In this context I tend to feel that Flash is meant to be eye candy (view) where as applet though designed to be versatile, takes the role of model on client side. It is to be noted that both applets and flash consume CPU cycles on client machine, hence were traditionally suited for tasks involving lengthy computation. Calculators, Report generators, Trend illustrators, Astrological chart generators (yes) and other tasks where data can be fed by user and are results shown immediately make use of these.
A major concern involves lack of client side software (Java, flash plugins). The user experience in such cases is more than annoying.
Noticed some comments about java not updating itself. Now 1.6.0_10 is out, and it's updating itself more easily and automated than before, and you have the option of a new install method, the java kernel one. This automates the install of java components as you need them.
Some text about this: http://java.sun.com/javase/6/6u10faq.jsp
So there are changes, Sun just wakes up with the new Ceo i think. I know it's 1-2 years until this new system propagates but you can start your project and have fun when it's ready maybe. :) Who knows.
Anyway, maybe you work +500% for easy animated features than flash, but if your app is not a simple animation, then you work +500% with flash for some simple 3 line java code substitution :) Depends on your app.
I worked in Java for the last 7 years, and then I recently started on AS3 on my newest project (1.5 years and going). I love AS3 and Flash, and here's why:
The language itself is very similar to Java. The documentation at Adobe is as good or better than JavaDocs.
The AS3 language supports XML as a native type. Parsing XML in Java is a nightmare.
There are nice animation and graphics frameworks for Flash, such as papervision 3D and tweener.
If you use the Flex 3 framework and Flex Builder 3, building interfaces that look as good or better than Swing is trivial. I loved writing UIs in Swing, but designing UIs in the visual Flex Designer is like a breath of fresh air.
I'm pretty sure that there's more browser support for Flash.
Have you ever seen a Flash applet load? It has really poor usability, and makes your user click through two or three dialogs before the applet starts. Flash apps just work.
Good luck on your project!