By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,967 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,967 IT Pros & Developers. It's quick & easy.

Java JLabel JPanel Graphics etc...

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
> ps: excuse my english :o) I hope you have understand my problem.

and understood ;o)
Jul 17 '05 #2

P: n/a
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.