What Layout should I use?

Dear friends:

I used several layout, but I am not sure for following requirement, which one is best layout.

for any number of images, I will drag and drop them into a panel in any position at my will so that it looks like real painting pane in an artist studio,

which layout is best?

I used GridLayout so far, but I met TWO problems

[1]. numbers of columns and rows are fixed, not flexible

[2]. image size is not adjustable

How to solve it?

Thanks

sunny

[514 byte] By [sunnymanmana] at [2007-11-26 19:02:16]
# 1
NullLayout
CarrieHunta at 2007-7-9 20:47:58 > top of Java-index,Desktop,Core GUI APIs...
# 2
Very good, is it something like this: public NullLayoutPane() {// Get rid of the default layout manager.//arrange the components ourselves.this.setLayout(null);?or different?Thankssunny
sunnymanmana at 2007-7-9 20:47:58 > top of Java-index,Desktop,Core GUI APIs...
# 3
GridBagLayout is the most flexible, but is the most difficultto learn http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.htmlMessage was edited by: juanchi
juanchia at 2007-7-9 20:47:58 > top of Java-index,Desktop,Core GUI APIs...
# 4
[url http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html]Using Layout Managers[/url]. Read the section on Absolute Positioning.
camickra at 2007-7-9 20:47:58 > top of Java-index,Desktop,Core GUI APIs...
# 5

Thanks a lot, I can use this absolute position with easy, but

pic1.setBounds(0, 0, 80, 80);

pic1.setBorder(null);

panel.add(pic1);

pic2.setBounds(80, 0, 80, 80);

pic2.setBorder(null);

panel.add(pic2);

and so on, all pic 1, pic2, ... can align together but they look bad because

[1]. they still have black line border surrounded, I hope to remove all these black lines;

[2]. pic1, 2,... are all empty images to wait for being dropped by DnD from some other image, before filled, they look like to be embebed or they look sink a little bit down with some slope, but I hope them almost as same level as Panel, no slope at all, not higher or lower, only with some very pale shadow line to indicate they are diff from panel is ok

How to do it?

Thanks

sunny

sunnymanmana at 2007-7-9 20:47:58 > top of Java-index,Desktop,Core GUI APIs...