|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Nov 2001
Messaggi: 6139
|
Mettere un bottone in un applet
Ciao a tutti , è possibile inserire in un applet un bottone?
Come posso fare? |
|
|
|
|
|
#2 |
|
Bannato
Iscritto dal: Nov 2001
Città: Verona
Messaggi: 1086
|
Eccome no!
Ecco un applet con un bottone
Codice:
import java.awt.*;
import java.applet.*;
public class MyApplet extends Applet {
public void init() {
Button bottone=new Button("Sono un bottone");
add(bottone);
}
}
Codice:
import java.awt.*;
import java.applet.*;
public class MyApplet extends Applet {
Button bottone=new Button("bottone");
public void init() {
add(bottone);
}
public boolean action(Event e, Object trg) {
if(e.target instanceof Button) {
String tag=(String) trg;
if(tag.equals("bottone")) {
bottone.setLabel("ciao");
return true;
}
}
return false;
}
}
Ciao. |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Nov 2001
Messaggi: 6139
|
Ti Ringrazio
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 01:41.


















