All pastes #23952 Raw Edit

Focus

public java v1 · immutable
#23952 ·published 2005-09-26 12:21 UTC
rendered paste body
package sks.testcase;import java.awt.BorderLayout;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JScrollPane;import javax.swing.JTextArea;public class TestCase extends JFrame implements ActionListener {	private JTextArea textArea;	public TestCase() {		super("Test Case");		Container cp = getContentPane();		cp.setLayout(new BorderLayout());		cp.add(new JScrollPane(textArea = new JTextArea("Example")));		textArea.setEditable(false);		JButton b = new JButton("Select 1-3");		b.addActionListener(this);		cp.add(b, BorderLayout.NORTH);	}	public void actionPerformed(ActionEvent e) {		textArea.select(1, 3);	}	public static void main(String[] args) {		TestCase tc = new TestCase();		tc.setSize(600, 450);		tc.setDefaultCloseOperation(EXIT_ON_CLOSE);		tc.setVisible(true);	}}