import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Test extends JFrame implements ActionListener { Container contPane; //--- Konstruktor --- public Test () { super("Test-Fenster"); this.addWindowListener(new WindowClosingAdapter(true)); Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); this.setBounds(50,50,screenSize.width - 100,screenSize.height - 100); contPane = getContentPane(); contPane.setLayout(new BorderLayout()); // JPanel zufügen JPanel pan_toolbar = new JPanel(); pan_toolbar.setBorder(BorderFactory.createEtchedBorder()); pan_toolbar.setLayout(null); pan_toolbar.setBounds(0,0,100,200); JLabel lab_test = new JLabel("Test-Label"); pan_toolbar.add(lab_test); JButton but_save = new JButton(new ImageIcon("BSsavef2.jpg")); but_save.setBounds(10,10,50,50); pan_toolbar.add(but_save); JButton but_exit = new JButton(new ImageIcon("BSexitg1.jpg")); but_exit.setBounds(70,20,50,50); pan_toolbar.add(but_exit); contPane.add(pan_toolbar, BorderLayout.CENTER); //this.pack(); this.setVisible(true); } //****************************************************************************** //* actionPerformed * //****************************************************************************** public void actionPerformed(ActionEvent ae) { String cmd = ae.getActionCommand(); if (cmd.equals("Beenden")) { this.setVisible(false); this.dispose(); } } public static void main(String args[]) { Test te = new Test(); }}