How to use null-layout in UIDesigner

Hi, i dont know how to use the null-layout in the UIDesigner. I have a form
with a panel, which contains 2 buttons. Panel have a null-layout. Compiler
generate this message: "There are not empty panels with XY layout"

What it means?

||| likeapear




10 comments
Comment actions Permalink

I'm sorry for my bad english, but I still don't know how to create a
null-layouted panel with any components. Is this feature available? Thank
you.

||| likeapear


0
Comment actions Permalink

Do you mean absolute positioning layout (XY)?

"likeapear" <likeapear@centrum.cz> wrote in message
news:bm37v8$t53$1@is.intellij.net...

I'm sorry for my bad english, but I still don't know how to create a
null-layouted panel with any components. Is this feature available? Thank
you.

>

||| likeapear

>
>


0
Comment actions Permalink

Yes, for example:

...
JPanel p=new JPanel(null);
...
JButton b1=new JButton("open");
b1.setBounds(10,10,50,15);
p.add(b1);
JButton b2=new JButton("close");
b2.setBounds(10,40,50,15);
p.add(b2);
...

There I must set bounds of each button manually (in java file). Is possible
to use the button coordinates stored in form-file?


||| likeapear


"Alexey Efimov" <aefimov@spklabs.com> pí?e v diskusním pøíspìvku
news:bm38cd$265$1@is.intellij.net...
Do you mean absolute positioning layout (XY)?



0
Comment actions Permalink

I miss this feature too, but i hope that it will be avaible for Aurora.
If you look in xml you must see follow for XY layout:
... ]]>

I think it just missed functionality. Now implemented only Grid, Horizontal
and Vertical layouts. Maybe XY planed.

Strange but if you look in 'shared' package in uiDesigner.jar - you can see
XYLayoutManager... but:
public class XYLayoutManager extends AbstractLayout {


public Dimension maximumLayoutSize(Container container) {
throw new UnsupportedOperationException();
}

public Dimension preferredLayoutSize(Container container) {
throw new UnsupportedOperationException();
}

public Dimension minimumLayoutSize(Container container) {
throw new UnsupportedOperationException();
}

public void layoutContainer(Container container) {
throw new UnsupportedOperationException();
}

public void setPreferredSize(Dimension dimension) {
throw new UnsupportedOperationException();
}

public final void invalidateLayout(Container container) {
}
}

So, now XY layouts is not supported, but maybe planned for Aurora ;)
Good luck!

"likeapear" <likeapear@centrum.cz> wrote in message
news:bm3dd7$car$1@is.intellij.net...

Yes, for example:

>

...
JPanel p=new JPanel(null);
...
JButton b1=new JButton("open");
b1.setBounds(10,10,50,15);
p.add(b1);
JButton b2=new JButton("close");
b2.setBounds(10,40,50,15);
p.add(b2);
...

>

There I must set bounds of each button manually (in java file). Is

possible

to use the button coordinates stored in form-file?

>
>

||| likeapear

>
>

"Alexey Efimov" <aefimov@spklabs.com> pí e v diskusním pøíspìvku
news:bm38cd$265$1@is.intellij.net...
Do you mean absolute positioning layout (XY)?

>
>


0
Comment actions Permalink

Thank you for perfect answer.

||| likeapear

"Alexey Efimov" pí?e v diskusním pøíspìvku news:bm3fj4$55n$1@is.intellij.net... I miss this feature too, but i hope that it will be avaible for Aurora. If you look in xml you must see follow for XY layout: ... ]]>

I think it just missed functionality. Now implemented only Grid, Horizontal
and Vertical layouts. Maybe XY planed.

Strange but if you look in 'shared' package in uiDesigner.jar - you can see
XYLayoutManager... but:
public class XYLayoutManager extends AbstractLayout {


public Dimension maximumLayoutSize(Container container) {
throw new UnsupportedOperationException();
}

public Dimension preferredLayoutSize(Container container) {
throw new UnsupportedOperationException();
}

public Dimension minimumLayoutSize(Container container) {
throw new UnsupportedOperationException();
}

public void layoutContainer(Container container) {
throw new UnsupportedOperationException();
}

public void setPreferredSize(Dimension dimension) {
throw new UnsupportedOperationException();
}

public final void invalidateLayout(Container container) {
}
}

So, now XY layouts is not supported, but maybe planned for Aurora ;)
Good luck!


0
Comment actions Permalink

NEVER do it! Use a layout manager instead.

Why not doing it? Because a change in the font (e.g. a different
platform), the text or something else makes the whole layout a crap.

Tom


0
Comment actions Permalink

:))
What about chess board UI for example?
Sure, using XYLayoutManager for building some text forms is not good, but if
you must create some UI fized size panel with conponents aligned by XY?

WBR,
--
Alexey Efimov, Software Engineer
Sputnik Labs,
http://www.spklabs.com


0
Comment actions Permalink

Try the GridLayout.

Tom

0
Comment actions Permalink

For rectangular controls the GridLayout is realy fine. But sometime someone
need to use custom control with not rectangular form.

But even if rectangled controls used, sometimes easy to use absolute
positining:

Chess board will drawed in paintComponent method of root JPanel whith have
chess pieces. Each of chess piece - is a imaged JLabel, it child of chess
board JPanel. Sure you can use GridLayout to layout all pieces, but easy to
programming use XYLayoutManager for it, i guess.

Thanks!



0
Comment actions Permalink

These cases are so rare (I never came across one), that programming them
manually is completely acceptable IMHO.

Tom

0

Please sign in to leave a comment.