codice:
public class robyed ...{
finestra win; // classe finestra
...
public void actionPerformed(ActionEvent ae){
Object sae = ae.getSource();
if(sae==otcol){ //otcol = JComponent
win = new finestra();
win.col("colore");
}
}
...
public class finestra extends JFrame implements ActionListener{
JPanel pane;
String what;
finestra(){
super("....");
pane = new JPanel();
/* PEZZO DI CODICE MANCANTE /*
setContentPane(pane);
}
public void col(String s){
what=s;
show();
}
public void actionPerformed(ActionEvent ae2){
Object sou = ae2.getSource();
}
}
}
questo non mi dà errore, ma, perche' se al posto di
/* PEZZO DI CODICE MANCANTE /*
inserisco
codice:
if(what.equals("colore")){
JLabel ciao = new JLabel("ciao");
pane.add(ciao);
}
mi restituisce errore???