Ich verstehe einfach nicht, was an diesem Code falsch sein soll:
Code:
/**
*
*/
package main;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.regex.*;
/**
* @author Daniel Ziltener
* @copyright 2007 by Lyrion
*
*/
public class Main extends JApplet implements ActionListener {
// Definition der Variablen
JEditorPane chatout;
JEditorPane userlist;
JPanel content;
JTextField input;
String password;
String chatroom;
String username;
String clan;
String statement;
String bc = this.getParameter("backColor");
String fc = this.getParameter("foreColor");
String fontc = this.getParameter("fontColor");
String tbc = this.getParameter("tabBorderColor");
String sfc = this.getParameter("scrollFrontColor");
String sbc = this.getParameter("scrollBackColor");
String borderc = this.getParameter("borderColor");
String ibc = this.getParameter("inputBackColor");
String ifc = this.getParameter("inputForeColor");
String bfc = this.getParameter("buttonForeColor");
String bbc = this.getParameter("buttonBackColor");
// ZUWEISEN DER VARIABLEN
Color backColor = Color.decode(bc);
Color frontColor = Color.decode(fc);
Color fontColor = Color.decode(fontc);
Color tabBorderColor = Color.decode(tbc);
Color scrollFrontColor = Color.decode(sfc);
Color scrollBackColor = Color.decode(sbc);
Color borderColor = Color.decode(borderc);
Color inputBackColor = Color.decode(ibc);
Color inputForeColor = Color.decode(ifc);
Color buttonForeColor = Color.decode(bfc);
Color buttonBackColor = Color.decode(bbc);
// Farben für die Userliste und Chatout
String HTMLbackColor = this.getParameter("HTMLbackColor");
String HTMLfontColor = this.getParameter("HTMLfontColor");
// INIT
password = this.getParameter("password");
chatroom = this.getParameter("chatroom");
long startTime = System.currentTimeMillis();
public void start()
{
// Aufbau der grafischen Oberfläche
// Layout definieren
content = new JPanel(new GridBagLayout());
content.setVisible(true);
content.setBackground(backColor);
content.setPreferredSize(new Dimension(800, 600));
this.add(content);
// ELEMENTE EINFÜGEN
// ZEILE 1
// Titel, Zeile 1, Spalte 1
JLabel titel = new JLabel(
"Lyrion Game Channel - Lobby (Build 103) User: " + username);
titel.setForeground(fontColor);
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.gridwidth = 2;
c.weightx = 1.0;
c.weighty = 0.0;
c.anchor = GridBagConstraints.CENTER;
content.add(titel, c);
// ZEILE 2
// Tab-Element, Zeile 2, Spalte 1
// JTabbedPane definieren
// Hier für jeden Raum eine andere Tab-Variante einfügen
// ZEILE 3
// Label, Zeile 3, Spalte 1
JLabel chatoutTitel = new JLabel("Chat:");
chatoutTitel.setForeground(fontColor);
c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 2;
c.gridwidth = 2;
c.weightx = 0.0;
c.weighty = 0.0;
c.anchor = GridBagConstraints.CENTER;
content.add(chatoutTitel, c);
// Label, Zeile 3, Spalte 2
JLabel userlistTitel = new JLabel("Userliste:");
userlistTitel.setForeground(fontColor);
c = new GridBagConstraints();
c.gridx = 1;
c.gridy = 2;
c.gridwidth = 2;
c.weightx = 0.0;
c.weighty = 0.0;
c.anchor = GridBagConstraints.CENTER;
content.add(userlistTitel, c);
// ZEILE 4
// Chat-Ausgabe, Zeile 4, Spalte 1
// Neues JPanel definieren
JPanel chatoutPanel = new JPanel();
chatoutPanel.setBackground(borderColor);
chatoutPanel.setPreferredSize(new Dimension(600, 250));
// Textarea definieren
chatout = new JEditorPane();
chatout.setContentType("text/html");
chatout.setText("Bitte warten...");
chatout.setEditable(false);
chatout.setToolTipText("Dies ist die Chat-Ausgabe");
// chatout.setEditable(false);
chatout.setPreferredSize(new Dimension(600, 250));
// Position setzen
c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 3;
c.weightx = 1.0;
c.weighty = 1.0;
c.gridwidth = 1;
c.fill = GridBagConstraints.BOTH;
// Scrollfeld definieren und einfügen
JScrollPane chatoutScroll = new JScrollPane(chatout);
chatoutScroll.setPreferredSize(new Dimension(200, 250));
chatoutScroll.setForeground(scrollFrontColor);
chatoutScroll.setBackground(scrollBackColor);
content.add(chatoutScroll, c);
content.add(chatoutPanel, c);
this.add(content);
// Userliste, Zeile 4, Spalte 2
// Neues JPanel definieren
JPanel userlistPanel = new JPanel();
userlistPanel.setBackground(borderColor);
userlistPanel.setPreferredSize(new Dimension(200, 250));
// Textarea definieren
userlist = new JEditorPane();
userlist.setContentType("text/html");
userlist.setEditable(false);
userlist.setText("Bitte warten...");
userlist.setToolTipText("Dies ist die Userliste.");
// userlist.setEditable(false);
userlist.setPreferredSize(new Dimension(200, 250));
// Position setzen
c = new GridBagConstraints();
c.gridx = 1;
c.gridy = 3;
c.gridwidth = 1;
c.weightx = 0.2;
c.weighty = 1.0;
c.fill = GridBagConstraints.BOTH;
// Scrollfeld definieren und einfügen
JScrollPane userlistScroll = new JScrollPane(userlist);
userlistScroll.setPreferredSize(new Dimension(200, 250));
userlistScroll.setForeground(scrollFrontColor);
userlistScroll.setBackground(scrollBackColor);
content.add(userlistScroll, c);
content.add(userlistPanel, c);
this.add(content);
// ZEILE 5
// Eingabefeld, Zeile 5, Spalte 1
input = new JTextField();
input.setBackground(inputBackColor);
input.setForeground(inputForeColor);
input.addActionListener(this);
c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 4;
c.gridwidth = 1;
c.weightx = 1.0;
c.weighty = 0.0;
c.fill = GridBagConstraints.HORIZONTAL;
content.add(input, c);
// Button, Zeile 5, Spalte 2
JButton send = new JButton("Senden");
send.setForeground(buttonForeColor);
send.setBackground(buttonBackColor);
send.addActionListener(this);
c = new GridBagConstraints();
c.gridx = 1;
c.gridy = 4;
c.gridwidth = 1;
c.weightx = 0.0;
c.weighty = 0.0;
c.fill = GridBagConstraints.NONE;
content.add(send, c);
// Ende Definitionen
// Einbinden anderer Klassen
}
}