Hallo zusammen,
Komme mit meinem Applet leider nicht weiter , ich habe in der ersten Programmzeile eine Fehlermeldung und zwar ist EReihe rot unterkringelt .
Die Klasse heist aber so daran kann es nicht liegen .
Die Fehlermeldung ist folgende
The type EReihe must implement the inherited abstract method ActionListener.actionPerformed(ActionEvent)
Hier noch das Programm
Komme mit meinem Applet leider nicht weiter , ich habe in der ersten Programmzeile eine Fehlermeldung und zwar ist EReihe rot unterkringelt .
Die Klasse heist aber so daran kann es nicht liegen .
Die Fehlermeldung ist folgende
The type EReihe must implement the inherited abstract method ActionListener.actionPerformed(ActionEvent)
Hier noch das Programm
Java:
import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
class EReihe extends Frame implements ActionListener
{
public EReihe() {
resize(800, 1000);
setLayout(new BorderLayout());
Panel pannelMain = new Panel();
Label labelInfo = new Label("Reihe E12 Informationen zur E12 Reihe unter");
// Dein Hilfe Button
Button buttonHelp = new Button("Hilfe");
// Mit ActionListener
buttonHelp.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Help");
try {
Desktop.getDesktop().browse(
new URI("http://de.wikipedia.org/wiki/E-Reihe"));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (URISyntaxException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
Button buttonExit = new Button("Exit");
buttonExit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Exit");
System.exit(0);
}
});
pannelMain.add(labelInfo);
pannelMain.add(buttonHelp);
// neuen Button für das Beenden
pannelMain.add(buttonExit);
add(pannelMain, BorderLayout.NORTH);
}
public void paint(Graphics stift) {
int z = 10;
int y = 250;
int h = 10;
int y2 = 500;
int x2 = 760;
int x3 = 760;
stift.fillRect(50, y2 + y, z, h);// y=250// vorderer Wert + 12
stift.fillRect(62, y2 + y - 2, z, 12);// y=248
stift.fillRect(74, y2 + 245, z, 15);// y=245
stift.fillRect(86, y2 + 242, z, 18);// y=242
stift.fillRect(98, y2 + 238, z, 22);// 2.2
stift.fillRect(110, y2 + 233, z, 27);// 2.7
stift.fillRect(122, y2 + 227, z, 33);// +0.6 //wert 3.3
stift.fillRect(134, y2 + 221, z, 39);
stift.fillRect(146, y2 + 213, z, 47);// Wert 4.7
stift.fillRect(158, y2 + 204, z, 56);// Wert5.6
stift.fillRect(170, y2 + 192, z, 68);// Wert 6.8
stift.fillRect(182, y2 + 178, z, 82);// Wert 8.2
stift.fillRect(194, y2 + 160, z, 100);// Wert 10
stift.fillRect(206, y2 + 140, z, 120);// Wert 12
stift.fillRect(218, y2 + 110, z, 150);// Wert 15
stift.fillRect(230, y2 + 80, z, 180);// Wert 18
stift.fillRect(242, y2 + 40, z, 220);// Wert 22
stift.fillRect(254, y2 - 10, z, 270);// Wert 27
stift.fillRect(266, y2 - 70, z, 330);// Wert 33
stift.fillRect(278, y2 - 130, z, 390);// Wert 39
stift.fillRect(290, y2 - 210, z, 470);// Wert 47
stift.fillRect(302, y2 - 300, z, 560);// Wert 56
stift.fillRect(314, y2 - 420, z, 680);// Wert 68
stift.drawLine(40, 50, 40, 760);// X-Achse
stift.drawLine(40, 760, 700, 760);// Y-Achse
while (x2 > 80) {
x2 = x2 - 10;
stift.drawLine(40, x2, 700, x2);
}
while (x3 > 120) {
x3 = x3 - 50;
stift.drawLine(700, x3, 720, x3);
}
stift.drawString("5", 730, 715);
stift.drawString("10", 730, 665);
stift.drawString("15", 730, 615);
stift.drawString("20", 730, 565);
stift.drawString("25", 730, 515);
stift.drawString("30", 730, 465);
stift.drawString("35", 730, 415);
stift.drawString("40", 730, 365);
stift.drawString("45", 730, 315);
stift.drawString("50", 730, 265);
stift.drawString("55", 730, 215);
stift.drawString("60", 730, 165);
stift.drawString("65", 730, 115);
}
public static void main(String[]args)
{
EReihe r4=new EReihe();
}
}