I'm aiming for the appearance of a rectangle when the mouse is clicked. Here's a snippet of my current code:
try{
image = ImageIO.read(file);
g.setColor(new Color(255,0,0));
g.drawRect(x, y, 100, 100);
}
icon = new ImageIcon(image);
label = new JLabel(icon);
label.addMouseListener(this);
public void mouseReleased(MouseEvent event) {
// TODO Auto-generated method stub
if(event.getSource() == label){
x = event.getX();
y = event.getY();
repaint();
input = JOptionPane.showInputDialog("Something:");
System.out.println(input);
}
}