import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* Summary description for turn
*
*/
public class turn extends JFrame
{
// Variables declaration
private JButton jButton1;
private JButton jButton2;
private JPanel contentPane;
// End of variables declaration
public turn()
{
super();
initializeComponent();
//
// TODO: Add any constructor code after initializeComponent call
//
this.setVisible(true);
}
private void initializeComponent()
{
jButton1 = new JButton();
jButton2 = new JButton();
contentPane = (JPanel)this.getContentPane();
//
// jButton1
//
jButton1.setText("clockwise");
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton1_actionPerformed(e);
}
});
//
// jButton2
//
jButton2.setText("anticlockwise");
jButton2.setMaximumSize(new Dimension(151, 25));
jButton2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton2_actionPerformed(e);
}
});
//
// contentPane
//
contentPane.setLayout(null);
addComponent(contentPane, jButton1, 26,32,83,28);
addComponent(contentPane, jButton2, 194,38,108,28);
//
// turn
//
this.setTitle("turn - extends JFrame");
this.setLocation(new Point(76, 59));
this.setSize(new Dimension(390, 300));
}
/** Add Component Without a Layout Manager (Absolute Positioning) */
private void addComponent(Container container,Component c,int x,int y,int width,int height)
{
c.setBounds(x,y,width,height);
container.add(c);
}
//
// TODO: Add any appropriate code in the following Event Handling Methods
//
private void jButton1_actionPerformed(ActionEvent e)
{
System.out.println("\njButton1_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jButton2_actionPerformed(ActionEvent e)
{
System.out.println("\njButton2_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
;
}
new turn();
}
}