hi every body!

i set the Layout to be null

setLayout(null);

.
when i resize the window, components do not resize.

if there any code that i can write to solve my problem?

please help!

Recommended Answers

All 4 Replies

Using a null layout manager is usually a mistake - layout managers are there for good reasons (different system font sizes on different machines, different screen resolutions, user-resizable windows...). This trick is to chose the simplest layout manager that does what you need. That usually means BorderLayout, FlowLayout, BoxLayout, or GridLayout. Remember a Panel can have a different layout manager from the frame that its in.
Here's a good place to start:
http://download.oracle.com/javase/tu...ut/visual.html

i do appreciate your reply!

i setBounds of each component!

I've tried layout managers, it works!. however, they do not provide absolute positioning there were no freedom.

That depends on which layout manager you use. GridBagLayout can give you absolute pixel-level positioning and sizing for everything (just like null manager), but still automatically handles changes in window size etc (unlike null manager). The choice is yours!

absolutely this is a kind of answer that i was looking for!

thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.