This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Rich Client GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Rich Client GUI" Watch "Rich Client GUI" New topic
Author

Rich Client GUI

Craig Boyd
Greenhorn

Joined: Aug 30, 2010
Posts: 21
Hello All,

I am about as green as you get. I have experience programming in a couple other languages, but no Java.

I want to write a simple desktop application. Which framework (is that the right term?) should I use? JavaFX? Swing? etc...?

Does it matter?

Thanks,

Craigbert
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Craig Boyd wrote:Hello All,

I am about as green as you get. I have experience programming in a couple other languages, but no Java.

I want to write a simple desktop application. Which framework (is that the right term?) should I use? JavaFX? Swing? etc...?

Does it matter?

Thanks,

Craigbert


Swing would be best, I'd recommend you get an evaluation version of JFormDesigner for the GUI development and download FatJar to bundle and deploy your application as a JAR file. With those two it's as simple as it gets.
Craig Boyd
Greenhorn

Joined: Aug 30, 2010
Posts: 21
Thanks Gerardo, I will check both of those out!

Craigbert
Jim Hoglund
Ranch Hand

Joined: Jan 09, 2008
Posts: 525
Craig : Welcome to JavaRanch. Be sure to come back here
with questions about your project. The details of GUI design
can get a bit frustrating (in my experience, anyway) and you
will find many helpful folks here.

Jim ... ...


BEE MBA PMP SCJP-6
Craig Boyd
Greenhorn

Joined: Aug 30, 2010
Posts: 21
Thanks Jim. That is really good to know.

Craigbert
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
Gerardo Tasistro wrote: . . . I'd recommend you get an evaluation version of JFormDesigner for the GUI development and download FatJar to bundle and deploy your application as a JAR file. With those two it's as simple as it gets.
But if you don't write code by hand, you will never understand what is going on. Avoid such automated tools like the plague until you are much more experienced.
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Campbell Ritchie wrote:
Gerardo Tasistro wrote: . . . I'd recommend you get an evaluation version of JFormDesigner for the GUI development and download FatJar to bundle and deploy your application as a JAR file. With those two it's as simple as it gets.
But if you don't write code by hand, you will never understand what is going on. Avoid such automated tools like the plague until you are much more experienced.


I've never found any value in writing that type of code. He'll have plenty of time to write code to handle the actual things the buttons will be doing. I believe frustration levels rise to quickly with GUIs if everything is written by hand.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
I see what you mean, but what happens when something goes wrong with a layout and you can't understand the code?

I think this thread would sit better on our GUIs forum, so I shall move it.
Craig Boyd
Greenhorn

Joined: Aug 30, 2010
Posts: 21
Campbell & Gerardo, thanks to both of for your thoughts and input.

I am the kind of person that loves to find something that works and then take it apart to learn the how and the why. But having said that I also like to roll up my sleeves and dig in, so you can both be assured that I will be taking both approaches as I begin my Java learning experiences.

Thanks,

Craigbert.
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Campbell Ritchie wrote:I see what you mean, but what happens when something goes wrong with a layout and you can't understand the code?

I think this thread would sit better on our GUIs forum, so I shall move it.


JFormDesigner keeps the initialization code very well contained and easy to read. If you read into it (and you can by just going into the init() method) you'll only see a series of variable initializations and layout configurations. It's the type of thing that's nice to go "oh wow that's how you do it, ok now back to work". When you add an action listener or method to respond to a button click or whatever all that happens is that said method stub is written for you with a nice // TODO ... . Once again something that's nice to see once and that's it. Since it isn't intrusive you can delete the original JFormDesigner file and work on from your java file.

If something goes wrong with the layout there's no way you can't understand the code unless you can't read Java.
Jim Hoglund
Ranch Hand

Joined: Jan 09, 2008
Posts: 525
Gerardo Tasistro wrote:... If something goes wrong with the layout there's no way you can't understand the code unless you can't read Java.

Gerardo : I guess that's just Campbell's point; that a beginning programmer can't read Java.
Keep in mind that a beginner does not know initialization code from today's rainfall, or a panel
layout from a shoe-shine kit. So what is a JFormDesigner anyway? Is it something a seamstress
would use? I'm sure you get the idea. So Campbell's advice makes a lot of sense, at least until
a novice can spell IDE.

Jim ... ...
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Jim Hoglund wrote:
Gerardo : I guess that's just Campbell's point; that a beginning programmer can't read Java.
Keep in mind that a beginner does not know initialization code from today's rainfall, or a panel
layout from a shoe-shine kit.


That's exactly my point. It's already a steep learning curve as it is. Let him use a nice drag and drop tool to do all the grunt work and then let him dig into the code once he understands the issues I find more important like events, updates and threads in a GUI. Not to mention friendly user design.

Not using a tool like that leads to a loss of time manually adjusting settings then previewing then adjusting then previewing. I find no merit in a trial an error GUI design methodology just because. I can understand Prefered Size from the manual, but I can't really visualize 250,40 or 220,60. Although I usually support the learning of the underlying technology in this case I don't. I find it the equivalent of teaching architecture by looking at the data structure of a CAD file. There is so much involved in the GUI that is visual and represented by parameters that not using a tool like that is counter productive. We're not developing a class hierarchy than can visualized in one's mind. This has to be previewed, touched, looked at, changed, previewed again etc. In general I believe GUI design is more an exercise in aesthetics and usability than code writing.
Jim Hoglund
Ranch Hand

Joined: Jan 09, 2008
Posts: 525
What's drag and drop? What's an event? And what is a thread? I guess
it's hard to remember what it was like when you knew absolutely nothing
about a topic. mmm... where to begin?

Jim ... ...
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I believe it's user preference. I learn better by writing the code. And in fact, I hate tools like JFormDesigner. Not because there is anything wrong with the tool, but because of what it does. Other folks love those kinds of tools. The best approach is to try it both ways and figure out what works best for you. You guys will continue to go back and forth until you realize this. There is no right way for everyone.


GenRocket - Experts at Building Test Data
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Gregg Bolinger wrote:I believe it's user preference. I learn better by writing the code. And in fact, I hate tools like JFormDesigner. Not because there is anything wrong with the tool, but because of what it does. Other folks love those kinds of tools. The best approach is to try it both ways and figure out what works best for you. You guys will continue to go back and forth until you realize this. There is no right way for everyone.


True, although there is no "best way" there is usually a "deadline". I enjoy writing a lot of the backing code like table, list and combo data models, fire events etc. But figuring out if 125 pts width will allow the text "Click to accept order" to fit my button is well needless in my opinion. That task is best handled visually by a tool like JFormDesigner.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Gerardo Tasistro wrote:That task is best handled visually by a tool like JFormDesigner.


For you, yes. And there are probably a handful of cases where I could say the same thing. That doesn't mean using JFormDesigner blindly is always the best option. To each his/her own.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
My, I really set off the discussion there, didn't I!
Jim Hoglund
Ranch Hand

Joined: Jan 09, 2008
Posts: 525
Yes, and all Craig wanted to know was how to get started. Interesting crowd, these JRanchers.

Jim ... ...
Craig Boyd
Greenhorn

Joined: Aug 30, 2010
Posts: 21
I was not expecting this much discussion of my question, but THANK YOU!!!
I was only expecting one or two posts. I hope all of my posts generate this much discussion because I will learn SO MUCH MORE!!!

Thanks all!

Craigbert
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
Craig,

I think at least to begin with you should create your GUI code 'by hand', without special tools, otherwise you could get confused. Building reasonable GUIs in Swing by hand is really not too difficult and you will soon get the hang of it....maybe then you can move to a GUI tool if that's your preference.

I work a lot with Swing and also the Java2D graphics API developing fairly complex GUIs and, after several years of doing this, I still prefer to code by hand. Just dig in and build some stuff!


SCJP 1.4, www.gsi3d.org.uk
 
Consider Paul's rocket mass heater.
 
subject: Rich Client GUI