class Swingtest1 extends JFrame implements ActionListener
{
JButton jb1;
public Swingtest1(String titel)
{
getContentPane().setLayout(null);
setTitle(titel);
jb1 = new JButton("ende");
jb1.addActionListener(this);
jb1.setBounds(10,getInsets().top + 5,70,20);
getContentPane().add(jb1);
}
public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == jb1)
{
dispose();
System.exit(0);
}
}
public static void main(String[] args)
{
Swingtest1 st = new Swingtest1("JTest");
st.setSize(300,300);
st.setLocation(100,100);
st.setVisible(true);
}
}
button.setMargin(new Insets(top, left, bottom, right))