//Title: Your Product Name //Version: //Copyright: Copyright (c) 1998 //Author: Your Name //Company: Your Company //Description: Your description package presentation; import java.awt.*; import java.awt.event.*; import com.sun.java.swing.*; public class ClickEvent extends JFrame implements ActionListener { private JButton click = new JButton("Click Me"); private JTextField welcomeText = new JTextField(); private JPanel thePanel = new JPanel(); public ClickEvent() { super("Event Example"); setSize(400,300); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); thePanel.setLayout(new GridLayout(2,1)); //this.getContentPane().add(click,BorderLayout.NORTH); thePanel.add(click); thePanel.add(welcomeText); this.getContentPane().add(thePanel,BorderLayout.CENTER); click.addActionListener(this); this.setVisible(true); } public void actionPerformed(ActionEvent e) { welcomeText.setHorizontalAlignment(JTextField.CENTER); welcomeText.setText("Hello Linux User's Group"); } public static void main(String[] args) { ClickEvent clickEvent1 = new ClickEvent(); } }