Disabing AutoResizing in GUI

hi :)

i磎 new here and a newbie in java, and i have this question that is if there is any way to completly disable the auto-rezings that the GUI tool aplies when drawing componets.

what happens is that when trying to put textpanes and comboboxes in place this is in fact going all the other way round and after everything is done and aparently in order, when i execute the program, everything is out of order, the sizes are all diferent, things go out of the frame etc.

if anyone can help me

thanxs in advance

[539 byte] By [Ashenvalea] at [2007-11-27 8:52:45]
# 1

You're probably using a GUI builder, and it is probably providing default behavior which isn't what you want.

If you read about layout managers, you'll be able to understand the code that's being generated for you. You might even come to the realization that the code generators and GUI builders are more of a pain in the butt than they're worth :).

http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html

kevjavaa at 2007-7-12 21:08:51 > top of Java-index,Java Essentials,New To Java...
# 2
thanxs for the fast replyso i assume there磗 no way to completly disable it :(actually i had already realised what you磛e said that most times using the GUI tool is nothing but a pain in the ***, but i was actually givin it a last change thanks :)
Ashenvalea at 2007-7-12 21:08:51 > top of Java-index,Java Essentials,New To Java...
# 3

> that the code generators and GUI builders are more of a pain in the butt than they're worth

For me, having to write the GUI building code by hand would be more pain in the butt.

It's not that I find the code hard to understand, it's just that I find them a bit hard to read. Why type coordinates if you can point them? Using a GUI builder is just very handy and visual.

What's wrong with a GUI builder?

In my opinion, for many apps there is nothing wrong with using a GUI builder.

NetBeans' GUI builder is very good. It supports all standard layouts. You can define your components local, private and public and you can make them static. NetBeans writes a function that you can call yourself from your initialisation code. So I don't think we suffer too much limitation.

tom_jansena at 2007-7-12 21:08:51 > top of Java-index,Java Essentials,New To Java...
# 4

I did use the words "may" and "probably" in there...

Some people have great luck with GUI builders. I have not had such good luck with the code produced, however. I find that code produced by my own hand is much more maintainable, and Netbeans/JBuilder/Igloo/whatever-GUI-builder-you're-using generally produce ugly code. Maybe I'm an overly anal-retentive control-freak.

There are many situations in which a GUI builder would be appropriate. If it works for you, then bravo. Use it to your heart's content, there's nothing wrong with that, and I probably won't even make fun of you :).

kevjavaa at 2007-7-12 21:08:51 > top of Java-index,Java Essentials,New To Java...
# 5

I've also found that unless you understand the code well, you won't be able to use the gui editor well. If you don't understand how a layout manager works, you won't be able to get the editor to layout your components the way you want. After all, the editor isn't doing the designing for you, it's just doing the typing for you, you still have to know how to write the code underneath. If you understand swing, then the gui editor can be very handy. I use it to do the grunt work of creating components and setting up layouts, then do the fine tuning by hand.

hunter9000a at 2007-7-12 21:08:51 > top of Java-index,Java Essentials,New To Java...
# 6
> Maybe I'm an overly> anal-retentive control-freak.No. I feel the same way. I always make GUIs myself.
CaptainMorgan08a at 2007-7-12 21:08:51 > top of Java-index,Java Essentials,New To Java...
# 7

this is an example of what happens to me.

http://img134.imagevenue.com/img.php?image=72254_s1_122_570lo.JPG

http://img177.imagevenue.com/img.php?image=72255_s2_122_504lo.JPG

the first links shows the program being executed and the second one while it is still being worked in GUI.

check the "gravar" JButton that the allignment in the GUI form is different than when to program is executed and also the "filme 1" and "filme2" jtextpane that end before the other ones while that does not happen while drawing components.

Ashenvalea at 2007-7-12 21:08:51 > top of Java-index,Java Essentials,New To Java...
# 8
> this is an example of what happens to me.it's not that bad...The slight difference you got is because NetBeans is using a different look&feel (L&F) to draw your panel than your app is using.So to fix it learn about L&F.
tom_jansena at 2007-7-12 21:08:51 > top of Java-index,Java Essentials,New To Java...