hey guys, I'm new to Java, and I need to highlight a part of an image with a rectangle, but I don't know if it is possible to modify a jpg picture this way. I found out on the internet that I could add a rectangle to an image and store it something called TexturePaint. I tried to put it on my JPanel, but it didn't compile. Anyone knows a simple way to display a TexturePaint or even better, how to add a simple rectangle in an image??
Rectangle Rect = new Rectangle(60, 70, image.getWidth(), image.getHeight());
TexturePaint TextureAux = new TexturePaint(image, Rect);
JPanel panel = new JPanel ();
panel.add(new JLabel(new ImageIcon(image)));
panel.add(new JLabel(new TexturePaintIcon(TextureAux))); //---> THIS DOESN'T COMPILE!
JFrame frame = new JFrame ("Images");
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);