package ch.usi.inf.sape.gui.test.app; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JComponent; import javax.swing.JFrame; /** * Test GUI capture and replay tools for their ability to handle mouse clicks * (of the different mouse buttons). * * See our AST'10 paper "Automating Performance Testing of Interactive Java Applications". * * Copyright (c) 2010 - Sape Research Group, University of Lugano */ public final class MouseClickTestFrame extends JFrame { public MouseClickTestFrame() { super("MouseClickTestFrame"); setDefaultCloseOperation(DISPOSE_ON_CLOSE); add(new JComponent() { { addMouseListener(new MouseAdapter() { public void mousePressed(final MouseEvent ev) { switch (ev.getButton()) { case MouseEvent.NOBUTTON: System.out.println("NOBUTTON"); break; case MouseEvent.BUTTON1: System.out.println("BUTTON1"); break; case MouseEvent.BUTTON2: System.out.println("BUTTON2"); break; case MouseEvent.BUTTON3: System.out.println("BUTTON3"); break; } } }); } }); setSize(300, 300); setVisible(true); } public static void main(final String[] args) { new MouseClickTestFrame(); } }