Hallo habe mal wieder ein Problem und zwar
gekürzter Quelltext:
Habe dann eine Methode in der ich bei Aufruf das bild wechseln will
das Problem ist das in der Methode neuesSpiel das Label und das Bild nicht bekannt sind ?!
Hoffe auf nen guten Tip danke schonmal
gekürzter Quelltext:
Java:
public static void main(String[] args)
{
// TODO Auto-generated method stu
final Container cont = window.getContentPane();
cont.setLayout(null);
final ImageIcon bild_001 = new ImageIcon("src/001.gif");
final ImageIcon bild_002 = new ImageIcon("src/002.gif");
final JLabel hangman = new JLabel(bild_001);
hangman.setBounds(170,50,453,378);
cont.add(hangman);
Habe dann eine Methode in der ich bei Aufruf das bild wechseln will
Java:
public static void neuesSpiel()
{
hangman.setIcon(bild_002);
}
das Problem ist das in der Methode neuesSpiel das Label und das Bild nicht bekannt sind ?!
Hoffe auf nen guten Tip danke schonmal