Re: polygon shape of jcomponent



> 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
> \ /
> \/
> /\
> / \
> 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).

--
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


.



Relevant Pages