0

How do I write an event listener that displays an image when I click the upload button?

so far i have

jButton1 = new javax.swing.JButton();
		jButton1.setText("Upload");
		jButton1.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton1ActionPerformed(evt);
			}
	});

and then

//the LOAD button for loading the file
	private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
		
	}

but I do not know what to write in the LOAD button section?

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Ezzaral
0

thanks, I also have another question:

I want to click on a point of a picture on my GUI, then display the coordinates that I have clicked on the image, how can I make it so that only the click on the image panel gets recorded, but not on other parts of the panel?

0

Add a mouse listener to whatever component you are using to display the image. You could use a JLabel or JPanel for that.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.