Hallo zusammen, ich stehe noch am Anfang von Java. Ich weiß nicht wieso ich hier bei WindowEvent e (ist bei mir Rot unterstichren von Eclipse)einen Fehler bekomme. Hoffentlich kann mir jemand helfen
DFanke im Vorraus
DFanke im Vorraus
Java:
/*
* Created on 25.05.2009
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author MUwahhid
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
import java.awt.*;
import java.applet.Applet;
import java.awt.Component;
import java.awt.event.ActionEvent;
public class RateGUI extends Frame{
public static void main (String [] args) {
RateGUI rate= new RateGUI();
}
public void actionPerformed(ActionEvent e) {
if (e.getSource()==bVersuch){
versuchClicked();
}
if (e.getSource()==bNeu) {
neuClicked();
}
if (e.getSource()==bInfo){
infoClicked();
}
}
public void windowClosing (WindowEvent e) {
dispose ();
System.exit (0);
}
public void windowClosed (WindowEvent e) {}
public void windowOpened (WindowEvent e) {}
public void windowActivated (WindowEvent e) {}
public void windowDeactivated (WindowEvent e) {}
public void windowIconified (WindowEvent e) {}
public void windowDeiconified (WindowEvent e) {}
Label labSuche1, labSuche2, labSuche3;
Label labText1, labText2;
TextField tfVersuch1, tfVersuch2, tfVersuch3;
Button bInfo,bNeu,bVersuch;
TextArea taInfo;
Font fntFett, fntHead, fntAusgabe;
Color cl;
public boolean handleEvent (Event e) {
if (e.target == bVersuch && e.id == Event.ACTION_EVENT) {
versuchClicked();
}
if (e.target == bNeu && e.id == Event.ACTION_EVENT) {
neuClicked();
}
if (e.target == bInfo && e.id == Event.ACTION_EVENT) {
infoClicked();
}
return false;}
private void neuClicked () {
taInfo.append("\"Neus Spiel\" geklickt\n");
}
private void versuchClicked () {
taInfo.append("\"Versuchen\" geklickt\n");
}
private void infoClicked () {
taInfo.append("\"Info\" geklickt\n");
}
public RateGUI(){
setSize (400,400);
setVisible(true);
setLayout (null);
labText1 = new Label("Raten Sie die drei Ziffern");
labText2 = new Label("Lِsung");
labSuche1 = new Label("X");
labSuche2 = new Label ("X");
labSuche3 = new Label ("X");
tfVersuch1=new TextField("");
tfVersuch2=new TextField("");
tfVersuch3=new TextField("");
bInfo=new Button("Info");
bNeu=new Button ("Neues Spiel");
bVersuch=new Button ("Versuchen");
taInfo=new TextArea();
labText1.setBounds(20,25,350,25);
labText1.setFont(fntHead);
labText2.setBounds(20,70,120,25);
labText2.setFont(fntFett);
labSuche1.setBounds(175,70,25,25);
labSuche1.setFont(fntHead);
labSuche2.setBounds(255,70,25,25);
labSuche2.setFont(fntHead);
labSuche3.setBounds(335,70,25,25);
labSuche3.setFont(fntHead);
tfVersuch1.setBounds(170,110,25,25);
tfVersuch1.setFont(fntFett);
tfVersuch2.setBounds(250,110,25,25);
tfVersuch2.setFont(fntFett);
tfVersuch3.setBounds(330,110,25,25);
tfVersuch3.setFont(fntFett);
bInfo.setBounds(20,160,80,25);
bInfo.setFont(fntFett);
bNeu.setBounds(140,160,100,25);
bNeu.setFont(fntFett);
bVersuch.setBounds(280,160,100,25);
bVersuch.setFont(fntFett);
taInfo.setBounds(20,210,360,140);
taInfo.setFont(fntAusgabe);
taInfo.setBackground(Color.cyan);
tfVersuch1.setBackground(Color.magenta);
tfVersuch2.setBackground(Color.magenta);
tfVersuch3.setBackground(Color.magenta);
add(labText1); add(labText2);
add(labSuche1); add(labSuche2); add(labSuche3);
add(tfVersuch1); add(tfVersuch2); add(tfVersuch3);
add(bInfo); add(bNeu); add(bVersuch);
add(taInfo);
fntFett=new Font ("SANSSERIF",1,14);
fntHead=new Font ("SANSSERIF",1,20);
fntAusgabe=new Font("MONOSPACED",0,12);
}
}