Al compilar un applet me sale el sgte error:
proveyears.java:42 incompatible types
found: int
required java.awt.TextField
a4 = y / 30;
proveyears.java:43 incompatible types
found: int
required java.awt.TextField
a4 = y % 30;
2 errors
El código es el sgte:
Código:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;// is for false true values
// <applet width="50" height="200" code="proveyears"></applet>
public class proveyears extends Applet implements ActionListener{
Label lab1, lab2, lab3, lab4, lab5;
TextField a1, a2, a3, a4, a5;
Button b1;
public proveyears(){
lab1 = new Label("Año");
a1 = new TextField();
lab2 = new Label("Dias");
a2 = new TextField();
lab3 = new Label("Año");
a3 = new TextField();
lab4 = new Label("Mes");
a4 = new TextField();
lab5 = new Label("Dias");
a5 = new TextField();
b1 = new Button("Convertir");
add(lab1);
add(a1);
add(lab2);
add(a2);
add(lab3);
add(a3);
add(lab4);
add(a4);
add(lab5);
add(a5);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae) {
int x = Integer.parseInt(a1.getText());
int y = Integer.parseInt(a2.getText());
a1 = a3;
a4 = y / 30;
a5 = y % 30;
}}