Zolf
asked on
java application which will respond to clicks on the image
i want to create a java application which will respond to clicks on the image.i want to know any tutorial or help i can get to get started with it.
Put the image in a JLabel and add a MouseListener to the label
label = new JLabel(new ImageIcon("x.jpg"));
label.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
// Respond
}
});
label.addMouseListener(new
public void mouseClicked(MouseEvent e) {
// Respond
}
});
yuou could use a JButton with an ActionListener.
ASKER
thanks for your replies.let me explain in more details.for example i get
an image of a stero system and if i clcik on the play button it should play
,if i click on the stop button it should stop playing....so on.
You need to add buttons maybe over the image? If so, implement your own JPanel and override the paintComponent method to display the image
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
shivspk those sites do not open which you mentioned.do they open for you???
:-)