Question in short:
What is the easiest way to mimic a swing based (skinned, customized) java GUI with .NET means?
Question explained:
Our main app has a swing based skinned (and customized) java GUI.
Apart from that we are going to build some smaller GUI equipped tools. Some of them will be .NET based windows applications with a windows forms GUI.
Now, to get a uniform user experience the GUIs of these .NET tools should be as close to our java based GUI as possible in both appearence and handling.
What is the easiest way to accomplish this?
What is the easiest way to accomplish this?
The easiest way to get a uniform Swing / Swing-like user interface is to implement everything in Java and Swing.
I've not heard of a Swing look-alike UI library for .NET. I guess it is theoretically possible, but it would be a lot of effort: probably orders of magnitude more work than implementing the tools the easy way.
So your practical alternatives are 1) implement the new tools in Java / Swing, 2) reimplement the old tools in .NET, or 3) forget about having a common UI look-and-feel.
This is not a joke answer ...
Try Windows Presentation Foundation (WPF) Themes instead WinForms as allow to change the controls Look & Feel. I think is not as easy and pluggable like Swing but could serve as an starting point.
Related
I'm new to Java frond end technologies. If we want to develop a cross platform java app and the look and feel should be like somewhat JQuery UI. If we don't want to use swing or Nimbus for front end, then what is the best option to achieve the JQuery UI look? I guess we can't use JQuery, as the app is a cross platform one. (must be running on linux, Solaris and Mobile) what you suggest?
Is Jerry can be a good option? (I never tried this thing. Find it here.
Thanks in advance.
If you want to create a cross-platform client side application there are basically three good (mature, proven, well-supported) options in Java:
Use Swing with pluggable look & feels to get the exact look you want. Nimbus is an example of a Swing look and feel, but there are many more. You can also create your own custom look and feels - this is quite a lot of work but does give you the flexibility to define exactly the look that you want. Swing is part of the standard Java distribution and behaves pretty much the same on all platforms, so if portability is your biggest concern, the Swing is a solid choice.
Use SWT which is the GUI toolkit from Eclipse. It's a great toolkit, though does have some native dependencies so you might have issues on mobile. SWT provides more of a "native" look and feel to each platform that you run it on.
Use JavaFX 2.0 which is the relatively new rich client framework from Oracle. Probably more suitable for graphical / rich media apps. Supports CSS-like styling which could be useful.
I'm not really familiar with Jerry, but it looks more like a DOM manipulation library rather than a GUI toolkit so I don't think it will help you much (unless you decide to move away from a client GUI and instead build a web-based front end).
Pretty soon now, we're gonna need to develop a GUI for creating configurations (more like scripts, to be honest) for our EAI solution at work. Think of a typical workflow editor. The visualization of the actual flows will most likely be a completely custom job, either in Swing, SWT or JavaFX 2. What I have trouble with choosing is whether to do everything else by ourselves or using a rich client platform.
In particular, I've noticed that JavaFX 2 is getting a lot of attention and seems to be really pushed by Oracle as the next big thing in the Java GUI landscape. The demonstrations look interesting and perhaps this newer API is more closely focused on productivity as opposed to the tons of boilerplate code that Swing tends to impose. Using a newer technology that gets a lot of support seems like a safe bet for future maintenance.
Using an RCP would have definite benefits for this project. Whether we go for Eclipse or NetBeans as the platform, having existing plugins/modules for viewing the underlying (XML) config, version control etc. would offer powerful functionality with minimal work. I also like the idea of having project types of our software next to Java projects in the same GUI. Even simple stuff like window management and customly arranging panels is much better handled by RCPs that what we could whip up.
So the question now is, what technology or combination thereof is viable? My options, as far as I can see, are thus:
Eclipse. I'm not too eager for using SWT, though, since I'm more familiar with Swing. NetBeans is also my primary IDE and I'm most familiar with it. It always felt more intuitive too.
NetBeans. This'd allow development of custom components in Swing. A lower learning curve for me.
NetBeans + JavaFX 2. This idea appeals to me... Use NetBeans for the RCP goodness and using JavaFX 2 for custom components. JavaFX 2 apparently integrates with Swing, but how well can this be done within NetBeans?
Swing or JavaFX 2. Do all the GUI work ourselves or use some existing framework(s) to get most of what an RCP offers. This seems like a lot of work but also offers superb control. I'm a bit loathe to try this in Swing. How well would JavaFX 2 suit itself to this?
Basically my only GUI experience is in Swing on small apps. This is the first time I'll be going for something that would warrant a RCP. But JavaFX 2 seems the way forward and I don't want to miss the boat on that one. If Swing might be on the way out, I'd prefer hopping onboard the newer technology.
If there are people who can share their experiences, have tried something like NetBeans + JavaFX 2 or are closer to the forefront of JavaFX and can recommend/discourage its use for this sort of thing I'd be most interested.
I realize it's a somewhat open question, but I can't really think of a more appropriate place. I'm not looking for a "what's the best RCP / is JavaFX better than Swing" debate. I'm looking for valid points for/against their use in this context.
My opinion in few lines,
JavaFX2 can be integrated into Swing and SWT applications into a panel/container.
Swing doesn't provide a structured architecture to deal with multi components applications, Eclipse RCP does but it's heavier and sometimes too complex (WindowWorkbench etc..) and hard to customize.
If you have a good UI Designer in your team (Developer or Graphic Designer) you should begin to work on an application Full JavaFX2 with a simple but powerful framework (like JRebirth or a custom one you can build on your own way).
JavaFX will be the Java UI Standard for years to come, It could'nt be a bad choice, thus its architecure is pretty good and powerful
Moreover javaFX2 could be used into a browser and/or deployed online with help of JNLP.
Don't bother you to learn complex undocumented framework (like EclipseRCP), create Yours !! and be free to make the application your client need :D
I worked 3 years on Swing Appz, 2 years on Eclipse RCP, and 2 years on Flex/Silverlight/JavafX apps
Here some points and (personal) opinions for helping you determining a proper solution for your current situation:
Eclipse vs. Netbeans
Personally, I dont't like big discussions about pros/cons of IDEs. Just use the one you feel most comfortable with. If you work in a team, make a voting. Considering Swing both IDEs are fine (IMHO Netbeans has the better GUI builder). Considering JavaFX 2.0 both IDEs are also fine but both share the absence of a GUI builder. I wouldn't recommend a mixture of IDEs.
JavaFX 2.0 vs. Swing vs. SWT vs. Eclipse RCP
Well, I don't - I even can't - want to tell you which of the above listed UI technologies is best since I don't know enough about your project's environment - experience, human resources, budget, timeline etc. Having a lean timeline and a team(?) of experienced Swing developers should lead the decision to Swing. Same for SWT and Eclipse RCP. Cutting edge developers might tend to try JavaFX. I agree, JavaFX gets a lot attention and you get great looking demonstrations, but keep in mind, that using JavaFX requires - additionally to the JRE - the JavaFX runtime on each client.
Hope this helps.
We switched to javaFx due to FXML usage,you can use MVC pattern ,you can add javascript and css init,but it seems slow when changing page
I am really confused over what to use. Options I see are awt, Swing and swt.
My question is which should be best for Desktop Java app on all platforms( Mac,Windows and Linux )with minimum platform dependent code ?
AWT is obsolete, though some of its classes and design form the underpinnings of the Swing API.
Here is my take on the differentiators between creating applications in Swing and SWT:
Swing
+ Forms part of the standard Java-SE platform, so fewer distribution headaches
+ You can create a consistent look and feel across platforms
+ Controls are lightweight, so creating your own is relatively easy
- If you need Swing applications to look like native applications, there may be a lot of work in it; Swing can be styled with a platform look'n'feel, but the results aren't always close enough for everyone's satisfaction
SWT
+ Easy to create simple applications which use native widgets
- Manual resource management
- You need to distribute platform-specific libraries
- You face the lowest-common-denominator problem - not all widgets are available on all platforms, so some will be custom to SWT anyway
Although I've put a lot more minuses against SWT, I wouldn't discount it. Which technology you pick will depend on your project requirements. Picking the library is only the beginning when it comes to UI development.
Swing is the easy, low-maintenance option and I'd agree with the other posters that this is probably the best fit for what you want.
Swing.
AWT is old and too low-level, SWT has native components, and doesn't ship with the JRE (it's a third-party library). Swing is high-level (-ish), and pure-java.
I would go with Swing as the best choice using what's packaged with Java. However, even Swing can make you jump through all the same hoops every time, so I would recommend looking into one of various frameworks that build on top of it and handle most of the boilerplate work of building an app.
There's a JSR for a Swing Application Framework which I have used when it was still in active development, but it's currently frozen. Their project page recommends a fork of that project, and another one called GUTS which uses Google Guice as its dependency injection. Netbeans also has Netbeans Platform.
I know the scope of these frameworks goes outside the realms of "UI", but they handle things like data-binding between your model and your UI which Swing does not do.
Can I build attractive GUI in Java? If yes, how should I do it? Or should I use some other language or tool to do it?
Filthy Rich Clients is a good book for learning how to use Java to build attractive GUIs that go beyond the usual Swing look.
You can use SWT, which as the other answer mentions is nice for a more native look. You can use JavaFx if you want to add a lot of visual candy, or you can use flash or other technologies and just perform remote operations.
Good luck.
You can just modify Swing look'n'feel as per this Java tutorial.
Attractive is quite subjective, but you can take a look to the Substance LaF (https://substance.dev.java.net/) and the Pushing Pixels blog (http://www.pushing-pixels.org)
If you are looking for a native look and feel in every platform you could use SWT. It's the one used in Eclipse.
You can build very attractive GUI using Java. You can use SWT: The Standard Widget Toolkit.
You have also mentioned if you can use other programming language then you can go for VIsual Basic.It will be easier than compare to Java. As we have to just drag and drop over there.
There are lots of answers on here about using SWT for an attractive native look and feel. However, I would suggest that Swing, set to use the native look and feel, is pixel perfect now, at least on Windows, using java 6. There is no longer a reason to use SWT. I work on a very large Swing project and you would be hard pressed to tell it is not a native windows app.
Edit: Here are a couple of links to some Sun blogs posts that touch on the subject -
http://weblogs.java.net/blog/bino_george/archive/2004/11/hifi_swing_or_i_1.html
http://weblogs.java.net/blog/chet/archive/2006/10/java_on_vista_y.html
Java is just a language. You cannot build a GUI in Java. Period.
The JDK libraries, however, can build guis through various means. You can use AWT, Swing, SWT, JavaFX or GWT libraries to build GUIs--or you can build your own library if you really want.
You can also just create an AWT frame and draw anything you want in it. (I worked on an waveform analyzer (o-scope looking thing) with a GUI written entirely in AWT.
Now, most of those libraries are fairly platform independent, if you want to restrict yourself to a single platform, you can do anything that can be done in C or any other language.
Therefore your question doesn't make too much sense. Are you saying that you want to put in minimum effort and get a good interface? Swing will be less effort than just about any other toolkit out there and can be skinned in more ways than most.
Or are you saying that you want to specify the exact GUI? In that case, don't use swing but there are a bunch of alternatives that should do just what you want.
Can you be more specific (Do you really want help?), or were you just trying to bash Java?
Swing is good in many ways, then why do we need JavaFX?
There is both a technology part of JavaFX that will help design UIs, and a language part that will make writing UIs easier.
The JavaFX technology brings a 2d scenegraph and video capabilities. Afaik these will also be made available generally to java. They are good advancements for creating client side application with fancy and interactive graphical UIs. The 2d scenegraph should make it possible to create more graphic heavy applications that are still responsive.
The JavaFX language is a much better way off creating UIs programatically. Java Swing code can get very verbose, while the same JavaFX code will be smaller and easier to maintain. Closure support makes creating event handlers easier. Declerative assignment of settings makes configuration of elements easier. Native list syntax makes adding components easier.
Please note that I haven't really written any JavaFX, but I have read code and paid attention to what's going on. I recommend trying it yourself to find out what's cooking.
I think Staale's answer is a good start but I would add...
Use JavaFX if
1) If you're interested in developing the application for mobile or TV (note this has yet to be released)
2) If you're working with a graphic designer who is creating the appearance of the application in photoshop and you want to be able to import their look directly.
3) If making the GUI filthy rich is important to you. (so if you want a panel to fade in or out, or slide upon demand)
Use Swing if
1) You're creating an application mainly for the desktop.
2) Performance matters and you know what you are doing (so if you're writing an IDE, Swing would be a better choice)
3) You're looking for a RPC (rich client platform) to build upon.
It is the same reason why we have Java, C++, C#, Python, Perl, Ruby... although we already have C.