Updating a jlabel

Posted by / 28-Nov-2020 16:50

And for Question 2 : I had a bit of doubt, as to what is So I have an Array List of Bitmap Images in my android app, and when I try to update the source of the image, nothing happens The Image View displays the first Bitmap Image without a problem in my app, but when I try to update the Image View with a new Bitmap...JDK 1.1.7A and Swing, on Windows NT In a simple Java application I have a JButton "btn Go" and a JLabel "lbl Status" within a JPanel.The part of the application that I am currently having trouble getting to work is being able to scroll through and display a list of images, one at a time.I'm getting a directory from the user, spooling through all of the files in that directory, and then loading an array of just the jpegs and pngs.When I click the Go button, I want the status label to immediately display the text "Working...", then I want to carry out some time-intensive tasks.However, the label text won't update until the tasks have all been completed.

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 haven't had enough time to read the whole of the code, but it seems peculiar that you are creating new Dice objects every time the action Performed methods are invoked.I don't think setting a value in the constructor looks correct; leave it blank.I'm guessing it's my temp Image = new JLabel that's the root cause.But I'm not sure how to convert my Buffered Image or Image to a JLabel in order to just update swing Image. It remains at it's position, and you simply call the one method to change the image, with no strings attached and the work is done, without any headaches.

updating a jlabel-58updating a jlabel-28updating a jlabel-18

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.

One thought on “updating a jlabel”