Java tutorial
import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.BevelBorder; public class Test extends JFrame { public static void main(String[] argv) { Test window = new Test(); window.setVisible(true); } public Test() { this.setBounds(100, 100, 200, 100); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED)); // panel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED)); this.setLayout(new FlowLayout()); JButton exitButton = new JButton("Exit"); panel.add(exitButton); this.add(panel); exitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); } }