import java.awt.*;import java.awt.event.*;import javax.swing.*;public class AboutBox extends JDialog implements ActionListener{ JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); JPanel insetsPanel1 = new JPanel(); JPanel insetsPanel2 = new JPanel(); JPanel insetsPanel3 = new JPanel(); JButton bn_close = new JButton(); JLabel lab_bild = new JLabel(); JLabel lab_product = new JLabel("Text"); JLabel lab_version = new JLabel("Text"); JLabel lab_copyright= new JLabel("Text"); JLabel lab_comments = new JLabel("Text"); // Konstruktor public AboutBox(Frame frame) { super(frame); enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { Init(); } catch(Exception e) { e.printStackTrace(); } //setResizable(false); pack(); } /**Initialisierung der Komponenten*/ private void Init() throws Exception { lab_bild.setIcon(new ImageIcon("deinBild.gif"); this.setTitle("I N F O"); panel1.setLayout(new BorderLayout); panel2.setLayout(new BorderLayout); insetsPanel1.setLayout(new FlowLayout); insetsPanel2.setLayout(new FlowLayout); insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); kompo.grid.setRows(4); kompo.grid.setColumns(1); insetsPanel3.setLayout(new GridLayout); insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10)); bn_close.setText("Schliessen"); bn_close.addActionListener(this); insetsPanel2.add(lab_bild, null); panel2.add(insetsPanel2, BorderLayout.WEST); this.getContentPane().add(panel1, null); insetsPanel3.add(lab_product, null); insetsPanel3.add(lab_version, null); insetsPanel3.add(lab_copyright, null); insetsPanel3.add(lab_comments, null); panel2.add(insetsPanel3, BorderLayout.CENTER); insetsPanel1.add(bn_close, null); panel1.add(insetsPanel1, BorderLayout.SOUTH); panel1.add(panel2, BorderLayout.NORTH); } /**Überschrieben, so dass eine Beendigung beim Schließen des Fensters möglich ist.*/ protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { cancel(); } super.processWindowEvent(e); } /**Dialog schließen*/ void cancel() { dispose(); } /**Dialog bei Schalter-Ereignis schließen*/ public void actionPerformed(ActionEvent e) { if (e.getSource() == bn_close) { cancel(); } }}