import javax.swing.*;
import java.awt.*;
public class LessonOne {
public static void main(String[] args) {
GridLayout myLayout = new GridLayout(2, 3);
JFrame frame = new JFrame( "Working with JButtons");
frame.setSize(100,100);
JPanel myPanel = new JPanel();
myPanel.setLayout(myLayout);
JButton newButton = new JButton ("Click Me");
newButton.addActionListener(this);
newButton.setToolTipText("This button does nothing...");
myPanel.add(newButton);
frame.getContentPane().add(myPanel);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
Toolkit.getDefaultToolkit().beep();
}
}