The program I'm creating is a basic snakes and ladders game. The buttons are created in a seperate class to the dice and the labels.I have got as far as generating two random numbers (ie two dice) and giving the user the option of selecting which amount they want to move by. The problem I'm having is updating the text in the labels to show the newly generated number after one of the buttons is clicked.I don't think setting a value in the constructor looks correct; leave it blank.You would do better to have a method which calls the random generator and resets the text in the JLabels whenever those actions are performed.Any advise is greatly appreciate it, as I say I know the label gets updated due to print statement byt the container has no effect. I don't think you need it; does it represent anything which cannot be done more easily with a plain simple JPanel? That would mean some restructuring to allow the Launcher to "listen" for things in the panels. Why does the get Panel method have Container as its return type?
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums Hi, I'm stuck on how to update a label.Same object, different state (unless you happen to get the same dice twice).