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?

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?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.