public Server() {
Panel Panel1 = new Panel();
Panel1.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
Label lbl_Protokoll = new Label("Protokoll:");
lbl_Protokoll.setBackground(SystemColor.menu);
Panel1.add(lbl_Protokoll);
Panel Panel2 = new Panel();
Panel2.setLayout(new GridLayout(1, 2));
Button btn_leeren = new Button("Protokoll leeren");
Button btn_beenden = new Button("Server beenden");
Panel2.add(btn_leeren);
Panel2.add(btn_beenden);
TextArea txta_Protokoll = new TextArea("", 10, 40, TextArea.SCROLLBARS_VERTICAL_ONLY);
setLayout(new BorderLayout());
add("North", Panel1);
add("Center", txta_Protokoll);
add("South", Panel2);
ActionListener al_Button_beenden = new ActionListener() {
public void actionPerformed( ActionEvent e ) {
System.exit(0);
}
};
btn_beenden.addActionListener(al_Button_beenden);
btn_leeren.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
txta_Protokoll.setText("");
}
});
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
System.exit(0);
}
});
}[/PHP]
txta_Protokoll ist das TextArea.
MfG
backdraft