Hi I have made a simple example. If i tap right click faster seems not have the same response of the left click of the mouse...why?
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;
import javax.swing.JFrame;
class MouseHandler implements MouseListener{
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
if(e.getButton()==MouseEvent.BUTTON1){
System.out.println("ssssssss");
}
if(e.getButton()==MouseEvent.BUTTON3){
System.out.println("dddddd");
}
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
}
public class PratoUI {
JButton b[][];
public PratoUI(){
JFrame finestra = new JFrame();
finestra.setLayout(null);
finestra.setSize(500,300);
finestra.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton b=new JButton("vvv");
b.setBounds(0,0,60,60);
b.addMouseListener(new MouseHandler());
finestra.add(b);
finestra.setVisible(true);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new PratoUI();
}
}