![](_gb_images/_gb_sitenav_spacer.gif) |
![](_gb_images/_gb_clear.gif) |
java gui book?
|
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_clear.gif) |
Fresh-Faced Recruit
Join Date: Jun 2003
Location: Charlottesville, VA
Status:
Offline
|
|
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
|
|
|
|
|
|
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_clear.gif) |
Fresh-Faced Recruit
Join Date: Nov 1999
Location: San Jose, CA, USA
Status:
Offline
|
|
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.
|
|
|
|
|
|
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_clear.gif) |
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
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.
|
|
|
|
|
|
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_clear.gif) |
Mac Enthusiast
Join Date: May 2001
Location: 127.0.0.1
Status:
Offline
|
|
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!
|
|
|
|
|
|
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_clear.gif) |
Fresh-Faced Recruit
Join Date: Nov 1999
Location: San Jose, CA, USA
Status:
Offline
|
|
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.
|
|
|
|
|
|
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_clear.gif) |
Mac Enthusiast
Join Date: May 2001
Location: 127.0.0.1
Status:
Offline
|
|
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).
|
|
|
|
|
|
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_clear.gif) |
Fresh-Faced Recruit
Join Date: Jun 2003
Location: Charlottesville, VA
Status:
Offline
|
|
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!! ![Wink](https://forums.macnn.com/images/smilies/oldschool/wink.gif) ). 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
|
|
|
|
|
|
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_clear.gif) |
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
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.
|
|
|
|
|
|
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_clear.gif) |
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
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
|
|
|
|
|
![](_gb_images/_gb_clear.gif) |
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_clear.gif) |
|
|
|
![](_gb_images/_img_misc/_gb_mb_previousthread-off.gif)
|
|
![](_gb_images/_gb_clear.gif) |
Forum Rules
|
![](_gb_images/_gb_clear.gif) |
![](_gb_images/_gb_clear.gif) |
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
![](_gb_images/_gb_clear.gif) |
![](_gb_images/_gb_clear.gif) |
![](_gb_images/_gb_clear.gif) |
![](_gb_images/_gb_clear.gif) |
|
![](_gb_images/_gb_sitenav_spacer.gif) |