wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes component layout on panel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "component layout on panel" Watch "component layout on panel" New topic
Author

component layout on panel

Mike McCue
Greenhorn

Joined: Nov 05, 2004
Posts: 3
I have just started getting into Java development, downloaded NetBeans, and am having a heck of a time with the layout of components on the frame. I can't seem to get anything to look like I want it to. I've been reading up on the various layout managers, and I'm thinking that gridbag is what I want to learn for more flexibility, but it's a pain to constantly think about the various divisions of the panel when placing a peice. Then when I want to add another component to the panel, I mess everything else up.

I've read that absolute positioning is no good because it's not scalable if the user should make the window bigger and such, how much truth is there to this? Would a different IDE be easier to use for the panels (I've downloaded JBuilder, but haven't had the chance to install or use it yet).

I'm coming from a VB background as far as client side development, I was hoping to have something as simple as the VS IDE for laying out the panels, just drag and plop it on there. Is there a way to achieve this level of ease with Netbeans?

I guess I'm shooting for popular consesus, how do you layout your panels, what's easiest for you?

Thanks for the time to answer
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

This is probably best suited in the Swing/JFC/Awt forum, so I'm going to move it there.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Mike McCue
Greenhorn

Joined: Nov 05, 2004
Posts: 3
Thanks Joel. So many forums, I didn't even notice one for this.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
I believe both NetBeans and JBuilder are GUI-builders, but I'd suggest you
are much better off, in the long term, to learn to do it without IDE assistance.

Here's a good tutorial on Layout Managers

http://java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/shortcourse.html
Mike McCue
Greenhorn

Joined: Nov 05, 2004
Posts: 3
Well, they're both GUI developers and full IDE's, allowing for all the nifty features that help support rapid development, including code completion, easier reading of code, and integrated debugging and such, so there's more to it. But yeah, I'm just looking at building the panels right now, and after reading through some threads on these forums, I'm getting the hankering to code em manually.

I'll take a look at the link, thanks for posting it.

Mike
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
I was hoping to have something as simple as the VS IDE for laying out the panels, just drag and plop it on there. Is there a way to achieve this level of ease with Netbeans?


Yep the NullLayout. Netbeans gives you this option.



Yep, this is why the NullLayout is not recommended. There is a fairly steep learning curve with the layout managers. If you are developing Swing guis proffessionally you will have to learn it.
I normally try and stick to Flow, Border and Box layout and nest panels to achieve the layout I want. You can achieve most things this way and it is much simpler than GridBag, I only bring that out when I have to.
Post your position woes here, folks are friendly, and someone will help !



GUI Builders can be useful for prototyping and messing around. However they do not produce production quality code, so they should not be used for this.

D.
Pat Hays
Ranch Hand

Joined: Aug 20, 2004
Posts: 138

If you are developing Swing guis proffessionally you will have to learn it.
I normally try and stick to Flow, Border and Box layout and nest panels to achieve the layout I want. You can achieve most things this way and it is much simpler than GridBag

You could use JFrameBuilder which is easy to do that. That will be much simpler than using GridBag.


Download Java GUI Builder, <a href="http://www.mars3000.com" target="_blank" rel="nofollow">http://www.mars3000.com</a>
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
How is that easier than using say, the NetBeans gui builder ? Does it get round the standard problems associated with gui builders ?
D.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: component layout on panel
 
Similar Threads
Netbeans Matisse
ide
my little problem on netbeans
Problem with GridBagLayout and a vertical layout of JPanels
Placing components with Swing