the errors are commented in the code:
help???
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import java.lang.*;
public class Kol2_1 extends Applet implements ActionListener
{
Button plus = new Button("+");
Button minus = new Button("-");
Button times = new Button("*");
Button div = new Button("/");
Button eq = new Button("=");
TextField pole = new TextField("E hej zver");
double x=0.0,y=0.0, z;
public void init()
{
try{
x=Double.parseDouble(JOptionPane.showInputDialog("Vnesete vrednost za x:"));
y=Double.parseDouble(JOptionPane.showInputDialog("Vnesete vrednost za y:"));
}
catch(StringIndexOutOfBoundsException n)
{JOptionPane.showMessageDialog(this, "Vnesete broj.");}
setLayout(new GridLayout(4,2));
add(plus);
add(minus);
add(times);
add(div);
add(eq);
add(pole);
plus.addActionPerformed(this); /*cannot find symbol method addActionPerformed(Kol2_1)*/
minus.addActionPerformed(this); /*cannot find symbol method addActionPerformed(Kol2_1)*/
times.addActionPerformed(this); /*cannot find symbol method addActionPerformed(Kol2_1)*/
div.addActionPerformed(this); /*cannot find symbol method addActionPerformed(Kol2_1)*/
eq.addActionPerformed(this); /*cannot find symbol method addActionPerformed(Kol2_1)*/
}
public void actionPerformed(ActionEvent e)
{
switch(e.getSource()){ //incompatible types
case plus: { z=x+y;}
case minus: { z=x-y;}
case times: { z=x*y;}
case div: { try{z=x/y;}
catch(NumberFormatException m)
{
if(y==0) JOptionPane.showMessageDialog(this,"Division by zero.");
}
}
case eq: {pole.setText(""+z);}
}
}
}