HeavyComboBoxTestFrame

package ch.usi.inf.sape.gui.test.app;
 
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.JComboBox;
import javax.swing.JFrame;
 
 
/**
 * Test GUI capture and replay tools for their ability to deal with combo boxes
 * with heavy-weight popups.
 * 
 * See our AST'10 paper "Automating Performance Testing of Interactive Java Applications".
 * 
 * Copyright (c) 2010 - Sape Research Group, University of Lugano
 */
public final class HeavyComboBoxTestFrame extends JFrame {
 
	public HeavyComboBoxTestFrame() {
		super("HeavyComboBoxTestFrame");
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		final JComboBox box = new JComboBox(new String[] {"1", "2", "3"});
		// place in south, so popup crosses the frame's boundary
		// (and becomes a heavy weight component)
		add(box, BorderLayout.SOUTH);
		box.addActionListener(new ActionListener() {
			public void actionPerformed(final ActionEvent ev) {
				System.out.println("action "+box.getSelectedItem());
			}
		});
		setSize(300, 300);
		setVisible(true);
	}
 
	public static void main(final String[] args) {
		new HeavyComboBoxTestFrame();
	}
 
}