bom galera, tenho tipo uns problemas em tentar fazer o programa funfar… eu tirei altos dum tutorial q eu tenho aki, porém falta alguma coisa neles, geralmente qndo dou “javaw CardTest.java” ele reclama q não foi possivel encontrar uma main class, entaum, acho q eh algo q falta…, bom ai vai o codigo:
import java.awt.<em>;
import java.applet.</em>;
import java.awt.event.*;
public class CardTest extends Applet implements MouseListener {
Panel p1, p2, p3, p4, p5;
Label l1, l2, l3, l4, l5;
CardLayout myCard;
Frame f;
public void start() {
CardTest ct = new CardTest();
}
public void init(){
f = new Frame (“Card Test”);
myCard = new CardLayout();
f.setLayout(myCard);
p1 = new Panel();
p2 = new Panel();
p3 = new Panel();
p4 = new Panel();
p5 = new Panel();
l1 = new Label(“This is the first Panel”);
p1.setBackground(Color.yellow);
l2 = new Label(“This is the second Panel”);
p2.setBackground(Color.green);
l3 = new Label(“This is the third Panel”);
p3.setBackground(Color.magenta);
l4 = new Label(“This is the fourth Panel”);
p4.setBackground(Color.white);
l5 = new Label(“This is the fifth Panel”);
p5.setBackground(Color.cyan);
p1.add(l1);
p1.addMouseListener(this);
p2.add(l2);
p2.addMouseListener(this);
p3.add(l3);
p3.addMouseListener(this);
p4.add(l4);
p4.addMouseListener(this);
p5.add(l5);
p5.addMouseListener(this);
f.add(p1,“First”);
f.add(p2,“Second”);
f.add(p3,“Third”);
f.add(p4,“Fourth”);
f.add(p5,“Fifth”);
myCard.show(f,“First”);
f.setSize (200,200);
f.show();
}
public void mousePressed(MouseEvent me) {
myCard.next(f);
}
public void mouseClicked (MouseEvent me ) {}
public void mouseReleased (MouseEvent me ) {}
public void mouseEntered (MouseEvent me ) {}
public void mouseExited (MouseEvent me ) {}
}
desculpe por naum colocar certinho bonitinho, eh pq eu sou novo no formu e nesses lances tb q eu nunca usei…
bom, eh isso ai, o prgraminha eh bem simples, eh pra qndo vc clicar ele mudar de cor, no appletviewer funfa de boa, mas ja qndo kero executar… se alguem poder me ajuda agradeço desde já
=]
