package prog2_aufgabe12; import java.awt.*; import java.awt.event.WindowEvent; import javax.swing.*; public class DebugFrame extends JFrame{ private JTextArea editor = new JTextArea(); IClose parent =null; public DebugFrame(IClose parent ) { this.parent = parent; this.setSize( 400, 400); setLocation(1080,10); setTitle( "Debug-Fenster"); setDefaultCloseOperation( JFrame.HIDE_ON_CLOSE ); setVisible(true); setGUI(); } /** * Aufbau der GUI-Elemente. * Einfuegen der "desktopPane" in CENTER. */ public void setGUI() { // BorderLayout setzen this.getContentPane().setLayout( new BorderLayout() ); this.getContentPane().add(new JScrollPane(editor),BorderLayout.CENTER); editor.setFont(new Font("Arial", Font.BOLD, 14)); this.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosed(WindowEvent e) { this_windowClosed(); } }); } private void this_windowClosed() { parent.closeDebugWindows(); } public void clear() { editor.setText(""); } public void add(String text) { editor.append(text+"\n"); } }