Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > java gui book?

java gui book?
Thread Tools
Wafflestomper
Fresh-Faced Recruit
Join Date: Jun 2003
Location: Charlottesville, VA
Status: Offline
Reply With Quote
Jul 13, 2003, 12:22 AM
 
so I thought I knew how to do gui stuff with java, at least to do what i wanted. It turns out that I don't and I'm starting to get annoyed with trying to teach myself. Thus, I need a reccomendation for a good book teaching me java gui's.

My problem is this, I can get everything that I want seeable, and I can get actions and such things responded to as I like, but I can't organize anything!!! It's so ugly, I can't figure out layouts, spacing, and for example how to get a button not to take up a the whole width of an area. Or how to set a panel to stay on the left side if added to another panel. I'm sure I'm just making it more difficult than it is, oh well.

btw, sorry to post this all java question to this board, but you guys have proved to be helpful in all manner of discussion thus far, so I thought I'd throw it out.

thanks a bunch
     
jobim
Fresh-Faced Recruit
Join Date: Nov 1999
Location: San Jose, CA, USA
Status: Offline
Reply With Quote
Jul 13, 2003, 01:41 AM
 
My problem is this, I can get everything that I want seeable, and I can get actions and such things responded to as I like, but I can't organize anything!!! It's so ugly, I can't figure out layouts, spacing, and for example how to get a button not to take up a the whole width of an area. Or how to set a panel to stay on the left side if added to another panel. I'm sure I'm just making it more difficult than it is, oh well.
I don't know of any book. However, your best bet is to experiment with different layout managers. They do just that, control layout of components in a container.

While not my daily use Java IDE, NetBeans http://www.netbeans.org does have a nice Java GUI Swing builder. And it's free, and decent under MacOS X. You can experiment there with various layouts and layout managers to get a better grasp on how layout works. Being able to play around certainly helps me. The latest pre-release alpha of IntelliJ's IDEA I believe also has a Swing GUI builder, so you could try that as well.

Hope this helps.
     
DaGuy
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Jul 13, 2003, 01:54 AM
 
I feel your pain... I went through a very similar experience a few years ago. I looked very hard but I never found a book that tackled Swing UI design in a practical way. Eventually I just gave up on it since not only were Swing UI's a mess to layout but it end result was slow and buggy. Today, I stilll work with Java but just J2EE with no Swing and that actually is a much nicer world.

Alas, I do have some advice. You may want to grab an IDE that handles UI design. I can think of JBuilder (the prior version ran on OSX), I believe there's also CodeWarrior for Java and some other ones. Layout some UI widgets via the IDE tool and then look at the resulting code -the reverse engineering deal.
     
joltguy
Mac Enthusiast
Join Date: May 2001
Location: 127.0.0.1
Status: Offline
Reply With Quote
Jul 13, 2003, 06:07 AM
 
Sounds like you've got a pretty good handle on the UI implementation already. Good UI presentation in Java has always been difficult because to do anything moderately advanced, you needed to become a wizard with GridBagLayout (scary).

After I completed the standard Java programmer's GridBagLayout hazing ritual, I went looking for alternatives. I found a couple that made Java UI layout a relative breeze!

HTMLlayout

PnutsLayout

With either of these, if you can write simple HTML table code, you can have a decent Swing UI in no time flat. Hope this helps!
     
jobim
Fresh-Faced Recruit
Join Date: Nov 1999
Location: San Jose, CA, USA
Status: Offline
Reply With Quote
Jul 13, 2003, 07:27 AM
 
Originally posted by joltguy:
Sounds like you've got a pretty good handle on the UI implementation already. Good UI presentation in Java has always been difficult because to do anything moderately advanced, you needed to become a wizard with GridBagLayout (scary).
If you're targeting JDK 1.4 you'll finally get a chance to use an unretarded layout manager, one based on the better UI concepts of the last 20 years. One that doesn't force stuff into grids and flows and pointlessly stretch all UI out of any recognizable shape.

SpringLayout

Check it out.
     
joltguy
Mac Enthusiast
Join Date: May 2001
Location: 127.0.0.1
Status: Offline
Reply With Quote
Jul 13, 2003, 08:40 AM
 
Originally posted by jobim:

SpringLayout

Check it out.
Thanks for the info! Just read through the page very quickly... it looks pretty nifty. I'll have to give it a try and see how it is for hand-coding the GUI, as the page mentions that it is primarily designed for use by GUI builders, which I use very infrequently (at least when building in pure Swing).
     
Wafflestomper  (op)
Fresh-Faced Recruit
Join Date: Jun 2003
Location: Charlottesville, VA
Status: Offline
Reply With Quote
Jul 15, 2003, 12:56 AM
 
First of all, you guys are all my heros for writing back normal, reasonable responses (not all forums have normal people posting with frequency). I appreciate that it isn't just me who can't figure java's gui stuff, but I am looking at SpringLayout, and then HTML and Pnuts.

If you guys don't do gui stuff in java, what do you do gui's in? I like to write in java so I can use it multiple places, but I need a front end (granted, I'm just writing self-serving little programs, but I still want them to look good!! ). How do you guys reconcile that issue?



sidenote: I shy away from non-java package stuff (eg, HTMLlayout) b/c I don't really know how to use it effectively. Class paths have always been a stumbling block for me, especially just moving to OS X. Compiling stuff doing 'javac -classpath "\asdf\asdf\asdf\" bla.java' just isn't any fun. I was reading a book (OS X for java geeks) and it kept telling me to set up a classpath for each project I had, but never really explained how. Any thoughts on this would be appreciated.

thanks again
     
DaGuy
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Jul 15, 2003, 02:07 AM
 
Cross plaform good looking GUIs are still an illusive dream. Java Swing is "ok" but nothing to cheer about. A lot of effort goes into building so-so GUIs. So what to do? A lot depends on what market you are or will be focusing on.

My Java world revolves around JSP thin clients. Much of the corporate market's need for cross platform is satisfied by similar technologies. So that's one thing to keep in mind as you move forward.
     
Arkham_c
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jul 15, 2003, 09:42 AM
 
Originally posted by Wafflestomper:
If you guys don't do gui stuff in java, what do you do gui's in? I like to write in java so I can use it multiple places, but I need a front end (granted, I'm just writing self-serving little programs, but I still want them to look good!! ). How do you guys reconcile that issue?
I use servlets. HTML is ubiquitous, and every platform can use an HTML-based app. I put the app on the server, and access it from the clients. Typically, I use Velocity templates or Struts for the MVC model.


sidenote: I shy away from non-java package stuff (eg, HTMLlayout) b/c I don't really know how to use it effectively. Class paths have always been a stumbling block for me, especially just moving to OS X. Compiling stuff doing 'javac -classpath "\asdf\asdf\asdf\" bla.java' just isn't any fun. I was reading a book (OS X for java geeks) and it kept telling me to set up a classpath for each project I had, but never really explained how. Any thoughts on this would be appreciated.
The key is to set up the classpath beforehand, and not try to build it on the command line. For development on the Mac, this is easy. Just put all the jars that you want to use in ~/Library/Java/Extensions and they will automagically be added to your classpath.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 07:53 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,