[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: how to determine the event when the left mouse button AND the right mouse button click at the same time

You probably have to track which buttons were clicked manually:

	label.addMouseListener(new MouseAdapter() {
		int buttons = 0;
	
		public void mouseUp(MouseEvent e) {
			buttons &= ~(1 << (e.button-1));
		}
	
		public void mouseDown(MouseEvent e) {
			buttons |= 1 << (e.button-1);
			if (buttons == 5 /* binary 00000101*/)
				System.out.println("left+right is down");
		}
	
	});


Viliam


Shuai Yang wrote / napísal(a):
hi all,
i want to know how to determine the event when the left mouse button AND the right mouse button click at the same time. i want to write a minesweeper game, as you know you can click the left and the right mouse button at the same time to open the cells that is not a mine in microsoft minesweeper. i just want to know how to determine this event.
thanks.