Si! xò è un codice di 1600 righe cmq ora vi sposto alcuni spezzoni ok...
codice:
public class Crea_Tavoli extends JFrame implements ActionListener{
***
***
***
String str;
Server ser;
***
public Crea_Tavoli(int n,String cam){
this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("cameriere.gif")));
try{
ser=(Server)Naming.lookup("rmi://localhost/ServerRemoto");
}
catch(Exception e){e.printStackTrace();
}
****
***
***
if(n==1){
cnt = getContentPane();
JPanel p6=new JPanel();
setSize(400,450);
setTitle("Sala 1");
p6.setLayout(new BoxLayout(p6,BoxLayout.PAGE_AXIS));
p6.add(Box.createVerticalStrut(50));
uno=new JButton("Tavolo:"+1);
try{
str=ser.getOrdine(1);
System.out.println(str); //OK mi stampa i valori
if(str.equals("")){
uno.setBackground(c.GREEN);
}
else{
uno.setBackground(c.red);
}
}
catch(Exception e){e.printStackTrace();}
uno.addActionListener(this);
p6.add(uno);
***
***
***
cnt.add(BorderLayout.CENTER,p6);
}
if(n==2){
cnt = getContentPane();
***
***
***
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}//costruttore
***
***
***
public String getStr() {
return this.str;
}
public void setStr(String str) {
this.str = str;
}
String lista2[]=null;
public void actionPerformed(ActionEvent e) {
***
***
if(e.getSource()==uno){
System.out.println(this.str+" "+this.getStr()); //Non stampa nulla
lista2=this.getStr().split("-");
System.out.println(lista2[2]+" "+lista2[3]);
ClientOrdiniProp frame=new ClientOrdiniProp(3,nome);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(false);
frame.setVisible(true);
}
}
Allora la sistem in actionPerformed lancia l'eccezzione NUllPointerException xke dice ke lista è vuota infatti se stampo getStr() nn mi dà nulla xò se la stampo nel costruttore si... spero ke mi aiutarete grazie....