All pastes #24806 Raw Edit

Miscellany

public text v1 · immutable
#24806 ·published 2005-10-07 04:37 UTC
rendered paste body
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class test extends JWindow{
	private JPanel container;
	private JTextArea textArea;
	
	public test(){
		setLayout(new BorderLayout());
	
		container = new JPanel();
		textArea = new JTextArea("foo bar");
		
		textArea.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F12,0), "exitAction");
		textArea.getActionMap().put("exitAction", new AbstractAction(){
			public void actionPerformed(ActionEvent e){
				System.exit(0);
			}
		});
		
		container.add(textArea);
		add(container, BorderLayout.CENTER);
		setSize(400,400);
		setVisible(true);
		
	}
	
	public static void main(String[] a){
		new test();
	}
	
	
}