Re: Drawing line on ImageIcon on panel after getting data
bH wrote:
...
public class IconMapShoScale extends JPanel{
This example might have been an SSCCE except for:
a) line wrap, which had to be fixed before it compiled
b) lack of images locally.
For the first, you might try <http://www.physci.org/twc.jnlp>
This little tool shows the width of the source/text pasted
in the text area. I recommned limiting it to '62 chars' for
usenet posts.
For the second, try obtaining images that are small (in bytes),
but large enough (in width/height) to show the problem,
directly off the net. If you have a site of your own, upload
some examples to use, otherwise the code might get them
off another site.
Here is one image search..
<http://images.google.com.au/images?q=+filetype:jpg&as_st=y&svnum=10&hl=en&sa=G&imgsz=icon
That search locates images that are 'small' in width/height.
As to the technical side of the problem, I suspect it is
non-optimal to create an ImageIcon. I would tend to use
a JPanel, override paintComponent and draw the Image
directly (Graphics.drawImage()). Once the points are
obtained, it is a simple matter to Graphics.drawLine()
(obviously, draw the lines *after* the image itself is drawn).
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via http://www.javakb.com