Java GUI alternatives [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I write applications in Java, and I'm looking for ways to speedup GUI programming. Binding frameworks help, but the particular application I'm working on now wouldn't benefit too much from that (it doesn't display a lot of data, just a lot of ways to manipulate the data). I feel like I spend way too much time writing boiler-plate GUI code, like adding action listeners, laying out components, etc. While I'm not a C# developer, I've heard XAML works very well and have seen JAXX, which appears to be similar to XAML. I'm also looking at the Groovy Swing Builder. It just seems like there are so many options, maybe even too many.
Can anyone share their thoughts on alternatives to hand writing simple Java UI code?
Also, I'd be interested in discussing how to migrate existing Java Swing code to use some of these options.
thanks,
Jeff

How about using MiGLayout?
It is extremely simple to learn and use.
I strongly recommend it to you. In my last project, it helped me to reduce much time to implement lots of GUI.

Layouts:
For layouts, I have abandoned the JDK Layout Managers in favor of the JGoodies Forms tool. I find it much more effective. It reads at a higher level, and reduces significantly the amount of code related to layouts.

I recommend using Clojure
It allows you to write Java GUIs quickly without the boilerplate.

Griffon is a Groovy framework for creating Java desktop applications. Admittedly, if you don't already know Groovy, you'll need to learn (some parts of) a new language to use it effectively, but the enhanced productivity is worth the effort in my opinion.

You should definitely use an IDE with GUI builder.
IntelliJ IDEA and NetBeans have very good GUI builders, they allow you to automatically bind objects and would reduce tremendously the amount of effort needed to create a GUI as opposed of doing it completely by hand.

I agree with others that tying down to NetBeans seems dangerous - especially when working with other developers. I've used the (commercial) Swing Designer (by "instantiations") plugin for Eclipse with quite a lot of success - the thing I like about it is that it round-trips, generating code that you are free to alter by hand. Not perfect, but a good time-saver.
But the biggest difference in my Swing programming came with the discovery of better layout managers. I went from FormLayout (good), to TableLayout (better), but now I don't use anything but MiGLayout (incredible).

You can try ZK(the best open source Java framework for building enterprise web and mobile apps).
http://www.zkoss.org/

I'm no expert in GUI programming, but have you tried using NetBeans as a platform for your app?

Related

Rewriting old/deprecated code java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
The company I work at has a piece of code they would like to rewrite. It uses Java/Java server faces. The problems with it are that it is old and uses depreciated code, was written in an IDE that is no longer available and doesn't work well with netbeans, and that it is kind of sloppy coding in the first place. No one really knows its structure and there is limited documentation.
Before beginning on the rewrite, we would like to find the structure of the old program and get a decent UML diagram. What tools would work the best in this situation? So far we have looked at one called Agilej.
Sorry if this is a little vague, I'm just a lowly intern an haven't been filled in on everything yet =p
You can use JArchitect, a pretty complete java static analysis tool
I'm not giving clickable hyperlinks as you should be able to find them easily through a web search and there may be more than 1 link that is useful for you
Sparx Systems Enterprise Architect has very powerful reverse engineering capabilities. Java (also compiled binary JAR) is in the list of supported languages.
I have used Enterprise Architect's reverse engineering features several years ago to help us understand and design modifications of legacy C++, QT code.
Enterprise Architect was able to automatically retrieve the class model. I then used the raw class model to drag/drop draw several other diagrams including only classes of my interest with level of detail I needed etc.
In the range of other static code analysis tools (e.g. the code flow visualization) I don't know which tool particularly supports Java well enough. Quick Google points e.g. to Coder Gears JArchitect. In the past project I have mentioned we used Doxygen's automatically generated documentation. Part of that were also some automatically generated graphviz dependency diagrams.
To clarify the design and visualize the flow (especially big legacy functions) I have found useful the Rapid Quality Systems Code Rocket flow visualizer
Once you get the basic facts at your hands through the various reverse engineering tools next step would be to go through them, annotate what is the unknown, what is doing what, basically apply some formal code review method (e.g. Fagan inspection or some of its derivatives).
(using evaluation versions of the various tools may be enough if you think ahead what are the required deliverables for your follow up actions. I guess the company is not planing to give you a >0$ budget)
The Agile Modeling site may have some good refactoring tips and some minimal UML mapping guidelines, start e.g. at Agile Legacy System Analysis and Integration Modeling

Regarding bulding gui and widgets in java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am a complete beginner in java. Although i have studied a lot of literature on the language (well sort of), this is my first real project.
I was basically planning to make a simple clock widget and later plan to build Gui s. Until now, i had learnt in swing. But then i found on this site that Swing is kinda outdated
( ref : Java GUI frameworks. What to choose? Swing, SWT, AWT, SwingX, JGoodies, JavaFX, Apache Pivot?).
What i needed was some good libraries in java to assist me in this process ( the clock widget and subsequently more complex gui). So i thought of getting libraries from jgoodies, the free ones.
And now i am utterly confused and messed up on what to do and dont understand anything. And of course i dont need books in design patterns etc etc. Just java references and some tutorials on gui using java and jgoodies to get me started. And i cant find them anywhere.
So please point me in right direction.
Reading background (Head First java, java the complete ref and data structures and algo)
(Suggest others if not sufficient)
AWT has effectively been replaced by Swing.
SWT is a different framework, which provides greater native interaction with the OS
JavaFX is the new player on the block, while some consider it a replacement for Swing, it's primary intention was to display Flash or act as an alternative to it.
SwingX and JGoodies are Swing based libraries.
Swing and SWT have begin around for quite some time, some might consider them to be "old", but what it does mean is there is a body of knowledge surrounding the frameworks, as well as a number libraries designed to support and extend them
JavaFX is new player on the market and has yet to build the same knowledge and support base.
If I was you. I would pay attention to Swing (personally) as it is going to provide you with the best ground base of experienced developers and support to help you on your way.
Once you become more comfortable, you could explore SWT, JavaFX and other toolkits and frameworks.
I would start with Creating a GUI with Swing, Performing Custom Painting and 2D Graphics.
My (personally) feeling is to build an understanding of the base library, try and learn it's strengths and weakness. This will help you understand when to use such libraries as SwingX and JGoodies - IMHO
What i needed was some good libraries in java to assist me in this process ( the clock widget and subsequently more complex gui). So i thought of getting libraries from jgoodies, the free ones.
Probably you don't need libraries as much as you think you do. Learn stuff from first principles and you will learn it better.
All the major Java GUI frameworks are quite high level and functional already. When you are first starting out, I think you should skip 3rd party libraries and see how far you get with what is provided in the base JRE and the framework of your choice. There is more than enough to learn with just the basic frameworks, the java language and the JRE. If you try to add in other frameworks too early, you will end up overloaded, confused and less productive. Plus the increased abstraction of the libraries may prevent you from learning some of the important underlying principles well enough.
Once you get a bit more experience in building things, then you will have a much better idea where the gaps in the frameworks are for your application and you can add in 3rd party libraries at that time.
planning to make a simple clock widget
If you get stuck, here is code for a JavaFX clock: How to draw a clock with JavaFX 2? or a similar implementation in Swing.
Note that creating a clock is quite a bit different than creating a traditional form based GUI that makes use of a library of predefined controls - but any of the major Java GUI frameworks can handle both tasks.
Don't make a clock your first GUI programming task, do something easier. Then try to create a clock later.
using swing for precise layout is really a difficult job
There are interactive graphical layout managers for Swing and other frameworks (e.g. the excellent SceneBuilder for JavaFX) which make this easier.
However, when first starting, it's probably worth hand coding stuff rather than letting a tool manage the layout for you (for example when learning JavaFX, stick with just the Java API and don't use FXML until you are completely comfortable with the Java API). You will learn the ins and outs of layout management and other things better that way. Sure you will make some mistakes and there will be a bit of frustration, but things will become clear in time with some persistence. And you may eventually end up deciding that you prefer hand-coding rather than using a graphical tool anyway.
The tricky part is usually creating quality, dynamically resizable GUIs that look good at different resolutions and window sizes - and that is generally tricky for beginners no matter what GUI toolkit is used.
The layout managers in JavaFX are very similar to the basic layout managers in Swing - so layout-wise there is little difference between the two frameworks.
The retained mode Scene Graph in JavaFX may be a bit easier to work with than the direct mode painting of Swing, but I guess that is not quite layout related.
Introspection tools, such as ScenicView for JavaFX, ease debugging layouts at runtime. Think of things like ScenicView as something similar to Firebug for HTML (e.g. your essential layout debugging companion).
And now i am utterly confused and messed up on what to do and dont understand anything.
You understand more than you think you do or you wouldn't have known enough to ask this question.
What you should do (IMO) is just pick a Java GUI framework (any framework - they are all passable), pick a decent starting task (something that seems mind-numbingly simple - even simpler than a clock) and start coding. Make everything task related; very small tasks with clear end-goals. Write a decent amount of code and always go back and revise your code and it's output to try to make it the very best it can be - don't settle for good enough.
Try painting rainbows and happy faces - when you code that up and see it on the screen, you will feel good about yourself :-)
If you need a refresher on the Java language, follow the Oracle Learning the Java Language trail. That trail is the way I learnt Java many years ago. It has been maintained over the years so that it is still a great resource and useful today.
If you choose Swing, follow the starting links from MadProgrammer.
If you choose JavaFX, follow the JavaFX tutorials and the Ensemble sample app but be aware that some of the JavaFX tutorials are targeted to more experienced programmers.

Swing vs JavaFx for desktop applications [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a very big program that is currently using SWT. The program can be run on both Windows, Mac and Linux, and it is a big desktop application with many elements.
Now SWT being somewhat old I would like to switch to either Swing or JavaFX. And I would like to hear your thoughts on three things.
My main concern is what will be better for a desktop GUI application? (I looked online and a lot of people suggest that JavaFX is just as good as Swing, but I didn't see many valid arguments except simple opinion flame wars). It has to work on both Windows, Mac and some popular Linux distributions.
What will be cleaner and easier to maintain?
and what will be faster to build from scratch?
I am using MVC methology in my application, if that is of any help.
What will be cleaner and easier to maintain?
All things being equal, probably JavaFX - the API is much more consistent across components. However, this depends much more on how the code is written rather than what library is used to write it.
And what will be faster to build from scratch?
Highly dependent on what you're building. Swing has more components around for it (3rd party as well as built in) and not all of them have made their way to the newer JavaFX platform yet, so there may be a certain amount of re-inventing the wheel if you need something a bit custom. On the other hand, if you want to do transitions / animations / video stuff then this is orders of magnitude easier in FX.
One other thing to bear in mind is (perhaps) look and feel. If you absolutely must have the default system look and feel, then JavaFX (at present) can't provide this. Not a big must have for me (I prefer the default FX look anyway) but I'm aware some policies mandate a restriction to system styles.
Personally, I see JavaFX as the "up and coming" UI library that's not quite there yet (but more than usable), and Swing as the borderline-legacy UI library that's fully featured and supported for the moment, but probably won't be so much in the years to come (and therefore chances are FX will overtake it at some point.)
As stated by Oracle, JavaFX is the next step in their Java based rich client strategy.
Accordingly, this is what I recommend for your situation:
What would be easier and cleaner to maintain
JavaFX has introduced several improvements over Swing, such as, possibility to markup UIs with FXML, and theming with CSS. It has great potential to write a modular, clean & maintainable code.
What would be faster to build from scratch
This is highly dependent on your skills and the tools you use.
For swing, various IDEs offer tools for rapid development. The best I personally found is the GUI builder in NetBeans.
JavaFX has support from various IDEs as well, though not as mature as the support Swing has at the moment. However, its support for markup in FXML & CSS make GUI development on JavaFX intuitive.
MVC Pattern Support
JavaFX is very friendly with MVC pattern, and you can cleanly separate your work as: presentation (FXML, CSS), models(Java, domain objects) and logic(Java).
IMHO, the MVC support in Swing isn't very appealing. The flow you'll see across various components lacks consistency.
For more info, please take a look these FAQ post by Oracle regarding JavaFX here.
JavaFX Frequently Asked Questions
No one has mentioned it, but JavaFX does not compile or run on certain architectures deemed "servers" by Oracle (e.g. Solaris), because of the missing "jfxrt.jar" support. Stick with SWT, until further notice.
I don't think there's any one right answer to this question, but my advice would be to stick with SWT unless you are encountering severe limitations that require such a massive overhaul.
Also, SWT is actually newer and more actively maintained than Swing. (It was originally developed as a replacement for Swing using native components).
On older notebooks with integrated video Swing app starts and works much faster than JavaFX app. As for development, I'd recommend switch to Scala - comparable Scala Swing app contains 2..3 times less code than Java.
As for Swing vs SWT: Netbeans GUI considerably faster than Eclipse...
I'd look around to find some (3rd party?) components that do what you want. I've had to create custom Swing components for an agenda view where you can book multiple resources, as well as an Excel-like grid that works well with keyboard navigation and so on. I had a terrible time getting them to work nicely because I needed to delve into many of Swing's many intricacies whenever I came upon a problem. Mouse and focus behaviour and a lot of other things can be very difficult to get right, especially for a casual Swing user. I would hope that JavaFX is a bit more future-orientated and smooth out of the box.

A good Swing project for learning best practices [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I would like if there is some project developed in Java to learn Swing best practices. I mean an open source project hosted on the Internet through SVN or similar. I've been reading some questions in Stackoverflow about this topic but I would see some projects. Thanks.
The way I learned Swing best practices was reading the Swing source code in the JDK and practice. Follow Sun's practices and you'll be on the right path.
Read the implementations of JTable, JTree, JScrollPane, the various LookAndFeels, SwingWorker, SwingUtilities. Their event handling and MVC patterns are extremely complex but very readable, maintainable, and extensible. Essentailly, every time you use a component, go read the source code and understand what and why they do it. Eventually, you'll start doing the same thing.
And most importantly, code. Write some large programs, and you'll start seeing things that don't seem right or optimal. Come on to Stack and find out what you're doing wrong or could do better. Write something else, and do the same.
That said, the following projects have (or probably have) good code:
SwingX - The maintainers of SwingX were Sun/ex-Sun people, and I've always thought of it as unofficial incubator for future Swing features.
Squirrel (A JDBC client) - I haven't actually looked at their source, but I've used the program for years and it doesn't show any of the common flaws in badly written Swing programs. With how powerful it is, and how well it works, I would put money that's its extremely well written.
InfoNode (A powerful docking framework) - I've gone through quite a bit of their code, and its pretty solid.
JFreeChart (A powerful charting library) - Not the greatest code, but much better than average, especially taking into account its an old project that was never really intended to do everything people are using it for. That said, it is very extensible, and I've never had a problem molding it to my needs (which are much, much more than its original intentions).
GlazedLists (A highly performant event-based list library) - Not exactly Swing, but it's event handling is similar to Swing. They also have implementations of Swing models and some custom components that are extremely fast.
JIDE Common Layer: A massive collection of custom components that serves as the basis for their commercial components. I haven't gone through their code, but their components are beautiful, and since their primary focus is commercial Swing components, once again, I'd put money that their code is solid.
I found it very interesting to see a professional-quality application written in Swing, such as IntelliJ IDEA Community Edition. Now that it's open-sourced, you can check out the code and start digging in. Be forewarned though, there are no comments!

Beginner Java Applications? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have learned that the best way to learn a language is by finding a good project to start on, and working out how you would create it. I've been programming for 4 years as a hobby, and it's only been in PHP, so I decided that I should learn a "real" programming language. I have tried C++ in the past, however I was never able to find a project that I could apply it to, and therefore I never really learned much.
Now, though, I'm checking out Java, and so far I really like it. My question for you is: What would be a good project or projects for a beginner to learn the main features of Java? I understand basic OOP practices and such. What I really want to learn is all the little libraries and functions inside of it. For example, in PHP you learn to use many array manipulations and other functions built-in to do work for you. I would like to learn what these are in Java.
As I said, I don't really want just documentation, I'd like a project that I can apply Java to.
Whenever I learn a new language I start with a Mandelbrot. Just to get the hang of loops, variables and drawing.
Many other simple learning progs are possible. For basic screen/key/mouse i/o and timers, try a Tetris, Breakout, or Clock/alarm clock. To learn audio interface make an Electric piano/synth. To learn maths/recursion/string manipulation i often write a quick expression parser + graphing prog. To learn sockets, you could try a simple p2p chat.
Java is a good choice, good luck!
My advice, take a project based course some university puts up. Something past COMP 101, but not too theory heavy.
This one's how my university breaks sophomores. Its fun, and requires you to think about design and (a little) about data structures. Good "salt of the earth" programming: consoles, file IO, parsing, collections, etc. No GUI, though there's another project for that and threading.
dont rush urself, get a good java book and study from the chapter 1st and make sure you solve all the exercises of each chapter. First get ur basic / foundation strong, then u can think about how to apply that knowledge in project. And make sure u also get a good book about algorithm. If you had an experiences in php for 4 years, you must developed something with php i can assume, so try to develop same application with Java now, it will give you good insight about Java. And one thing... try to focus on how you can write good quality code! Anybody can write code but good quality code is rare, focus there.
while general, I would say find a web application that interests you. If you are familiar with PHP, you are probably familiar with many web technologies. Java on the server is a nice alternative to PHP, and deploying a Java web application is pretty simple.

Categories