views:

102

answers:

1

hello, I have an image a map, The image must be contained in a JFrame and asked whether there are any java method that given coordinates (x, y) must make a kind of water mark or repaint the picture only in the specified coordinate

anyone knows how to do or any idea how it would try to do ??

+2  A: 

Create a new SubClass of ImageIcon and ovveride the method paintIcon. E.g.:

    class MyImageIcon extends ImageIcon
    {
    public MyImageIcon(Image img)
      {
      super(img);
      }
   public  void paintIcon(Component c, Graphics g, int x, int y)
     {
     super.paintIcon(c,g,x,y);
     g.drawLine(0,0,10,10);// .... paint your mark here
     }
    };

then put this MyImageIcon in a JLabel.

Hope it helps Pierre

Pierre