yes, any shape is possible.

Signature
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
Subject: Re: polygon shape of jcomponent
>> polygon shape of jcomponent, is it possible?
> yes, any shape is possible.
Can you give me any adivce, please? :-)
I've seen only .setSize(width, height)
and setBounds(x,y,w,h) :(
and - imho - i really afraid that if i have 2 line
like this
\ /
\/
/\
/ \
will I be able to recognize which (Lines extends JComponent) I clicked,
dragged, moved, etc
Andrey Kuznetsov - 30 Dec 2005 11:07 GMT
> Can you give me any adivce, please? :-)
yes
> I've seen only .setSize(width, height)
> and setBounds(x,y,w,h) :(
you should decide what to do on resize. You can:
a) ignore
b)scale your shape
> and - imho - i really afraid that if i have 2 line
> like this
[quoted text clipped - 4 lines]
> will I be able to recognize which (Lines extends JComponent) I clicked,
> dragged, moved, etc
override JComponent#contains(int x, int y) so that it returns
polygon#contains()
or write <yourComponent>UI and override ComponentUI#contains(JComponent c,
int x, int y)
Download source of JGui 1.38 (here:
http://jgui.imagero.com/download/JGuiSrc138.zip)
and look at JShape, BasicShapeUI and ShapeUnit.
Note that this is spen source version of JGui and contains bugs (which are
fixed in full version).

Signature
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities