470,833 Members | 1,666 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

Java JLabel JPanel Graphics etc...

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.
Jul 17 '05 #1
2 7397
> ps: excuse my english :o) I hope you have understand my problem.

and understood ;o)
Jul 17 '05 #2
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.

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by pnolan | last post: by
oll3i
reply views Thread by oll3i | last post: by
1 post views Thread by twin2003 | last post: by
2 posts views Thread by carlos123 | last post: by
1 post views Thread by tommyny04 | last post: by
2 posts views Thread by yeshello54 | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.