Re: Java JLabel JPanel Graphics etc...

From: Tom N (tom_at_nospam.au)
Date: 02/18/04


Date: Wed, 18 Feb 2004 03:05:46 GMT

You have to integrate your painting of the lines in with Swing's painting.
You could override paintComponent(Graphics g) (inherited from JComponent) on
the JFrame.
Don't forget to call super.paintComponent(g)

"Jean-Philippe Martin" wrote:
> Hi all,
>
> It's my first post here, so you doubt I have a question :o)
>
> I want to develop a mini graphical editor. Imagine that I have 2 JFrame, I
> want to have one with a list of JToggleButton with a ImageIcon and one
> called DrawingAeraWind with nothing into.
>
> I would like to be able to draw the ImageIcon of the selected
JToggleButton
> in the DrawingAeraWind if I click into this window. I would like to be
able
> to drag and drop the drawn image in the DrawingAeraWind (just to change
its
> position).
>
> For now, I'm able to do this.
>
> I want to add a functionality to my light editor. I want to add a
> JToggleButton which didn't represent a ImageIcon to add in the
> DrawingAeraWind but wich represent a link between 2 drawn Images. For
> exemple, if I already have drawn 2 images in the DrawingAeraWind and that
I
> select this new (link) JToggleButton, I want to be able to select the 2
> drawn images in the DrawingAeraWind (by clicking on it) and to display a
> line (graphic.drawline(image1, image2) )between these 2 images.
>
> My problem is that my 'link' line is not visible, or is clipped, etc...
>
> I use some JLabel to represent my drawn Image (to be able to do drag and
> drop on it) and I use graphic.drawline() for the link line.
>
>
> ps: excuse my english :o) I hope you have understand my problem.
>
>