How to implement the mouseRelesed(MouseEvent me) and mouseClicked(MouseEvent me)
methods when the mouse button is clicked and the mouseReleased method do nothing.

import java.applet.Applet;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class Example extends Applet implements MouseListener {

	public void init() {
		addMouseListener(this);
	}
	
	public void mousePressed(MouseEvent me) {
		
	}
	
	public void mouseReleased(MouseEvent me) {
		System.out.println("mouse released");
	}
	
	public void mouseClicked(MouseEvent me) {
		System.out.println("mouse clicked");
	}
	
	public void mouseExited(MouseEvent me) {
		
	}
	
	public void mouseEntered(MouseEvent me) {
		
	}
}

You need to associate/attach to some object button, text box etc

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.