aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Ambiquity while drawing multiple shapes on Jpanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Ambiquity while drawing multiple shapes on Jpanel" Watch "Ambiquity while drawing multiple shapes on Jpanel" New topic
Author

Ambiquity while drawing multiple shapes on Jpanel

looka dicosta
Greenhorn

Joined: Nov 22, 2012
Posts: 21
It is a duplicate thread posted in other forum but don't get satisfied answer from their. so Hoping to get a better answer from here.Ambiquity while drawing multiple shapes on Jpanel. 0 down vote favorite


Th code below has few problems :

1) The polygon joins last and first point itself, should not do itself but user should draw it.

2) The polygons lines disappeared after clicking on other shapes.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> It is a duplicate thread posted in other forum but don't get satisfied answer from their

sorry, but unless you post the link, any response here may be just a duplicate

you want help, ok, that = posting the link so we can see the responses, so far,
and perhaps come up with a different/better response.
looka dicosta
Greenhorn

Joined: Nov 22, 2012
Posts: 21
Michael Dunn wrote:> It is a duplicate thread posted in other forum but don't get satisfied answer from their

sorry, but unless you post the link, any response here may be just a duplicate

you want help, ok, that = posting the link so we can see the responses, so far,
and perhaps come up with a different/better response.


other forum link
looka dicosta
Greenhorn

Joined: Nov 22, 2012
Posts: 21
The link to other forum
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39885
    
  28
Now we all know about the cross’post her …
You ought to tell the chap who replied on SO that you have posted here, too.

Why are you using an image? You would not usually use an image to draw on. You draw directly onto the panel. That should allow the shapes to appear over one another in the order they are painted. The suggestion on the other forum of creating Shape objects and keeping them in a List is sound. Far better than trying to do everything in the paintComponent method.
As for closing or not closing polygons, there are ways to do that, but I can’t remember definitely. I think you may need to learn how to use a GeneralPath object. No, not that; it says to use this instead.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ambiquity while drawing multiple shapes on Jpanel