• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doh! How do you draw a line on an image?

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First up I really appreciate any help here. I've been beating my head against the wall on this for days now, seaching the Internet looking for examples but no luck. All I want to do is draw some lines on some images and then erase them if needed. It really can't be that hard to do can it?
Currently I have a JApplet that loads images from a jar file. This applet can scale the images, and move them left right, up and down. Right now the JApplet loads an image, which is then converted to an ImageIcon, which is then used to create a JLabel, which is used to create a JScrollPane which finally gets added as a tab on a JTabbedPane. So, when you click a tab, you see an image. I then want to be able to draw a line on that image (I'll worry about placing the line where I want it later!).
I can get a line to draw on a copy of the image, but I cannot seem to get that image to draw where it is supposed to as it always draws in the upper left hand corner.
What I really want is for the new image (the image with a line in it) to replace the old image. The way it is now, both the old and new images still get drawn with the new one having a line on it.
Here is the code I have so far:

Again, I really appreciate any help you could give.
Thanks.
[ August 06, 2003: Message edited by: Darrin Smith ]
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try the following link to the java 2d trail at sun. . http://java.sun.com/docs/books/tutorial/2d/problems/index.html
hope this helps
 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
That is one of the first things I looked at, and pretty much what I think I'm doing, but I appreciate the effort.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic