FileDocCategorySizeDatePackage
ButtonPanel.javaAPI DocExample1583Tue Nov 27 14:15:46 GMT 2001None

ButtonPanel

public class ButtonPanel extends JPanel

Fields Summary
private JTextField
log
Constructors Summary
public ButtonPanel(JTextField tf)

		this.log = tf;
		// create button
		JButton btn = new JButton("Push me",
				new BoxIcon(Color.blue,2));
		// set alternative icons
		btn.setRolloverIcon(new BoxIcon(Color.cyan,3));
		btn.setPressedIcon(new BoxIcon(Color.yellow,4));

		// set text to left of icon
		btn.setHorizontalTextPosition(JButton.LEFT);
		
		// set border
		btn.setBorder(BorderFactory.createEtchedBorder());

		// set listener
		btn.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				log.setText("Button was pressed");
			}
		});
		
		// add button to panel
		add(btn);
	
Methods Summary