acá esta la segunda classe
2-tarea1.java
Código java:
Ver original/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Applet;
import java.applet.Applet;
import java.awt.*;
public class Tarea1
extends Applet { Tarea1Cls t1=new Tarea1Cls();
int f=0;
@Override
public void init() {
resize(600,600);
setLayout(null);
add(b1);
b1.setBounds(10, 10, 60, 20);
add(b2);
b2.setBounds(80, 10, 60, 20);
add(b3);
b3.setBounds(150, 10, 60, 20);
add(b4);
b4.setBounds(220, 10, 60, 20);
add(b5);
b5.setBounds(290, 10, 60, 20);
add(b6);
b6.setBounds(360, 10, 60, 20);
add(b7);
b7.setBounds(430, 10, 60, 20);
add(b8);
b8.setBounds(250, 40, 60, 20);
add(txt1);
txt1.setBounds(10, 40, 50, 20);
txt1.setVisible(false);
add(txt2);
txt2.setBounds(70, 40, 50, 20);
txt2.setVisible(false);
add(txt3);
txt3.setBounds(130, 40, 50, 20);
txt3.setVisible(false);
b8.setVisible(false);
}
@Override
if (f!=8 && f!=7) {
txt1.setVisible(false);
txt2.setVisible(false);
txt3.setVisible(false);
b8.setVisible(false);
}
switch(f) {
case 0:
break;
case 1:
t1.Pantalla_Tarea1(g);
break;
case 2:
t1.Pantalla_Tarea2(g);
break;
case 3:
t1.Pantalla_Tarea3(g);
break;
case 4:
t1.Pantalla_Tarea4(g);
break;
case 5:
t1.Pantalla_Tarea5(g);
break;
case 6:
t1.Pantalla_Tarea6(g);
break;
case 7:
txt1.setVisible(true);
txt2.setVisible(true);
txt3.setVisible(true);
b8.setVisible(true);
txt1.setText("");
txt2.setText("");
txt3.setText("");
break;
case 8:
t1.Pantalla_Tarea7(g,txt1,txt2,txt3);
break;
default:
g.drawString("Función no implementada.",40,40);
}
f=0;
}
@Override
if (arg== "Choque") {f=1;}
if (arg== "Flecha") {f=2;}
if (arg== "Planeta") {f=3;}
if (arg== "Cuadrado") {f=4;}
if (arg== "Onda") {f=5;}
if (arg== "Colores") {f=6;}
if (arg== "Barras") {f=7;}
if (arg== "Calcular") {f=8;}
repaint();
return true;
}
}