i have a repaint issue where UI doesn't get updated unless i change teh size of the window or minimize , maximize the window
Any ideas ?
scenario: i have a panel class which can set its labels and this panel is being added on to a frame in another class and when we invoke method from panel to set label icons or text it doesn't show on the screen unless i resize of do something which makes it do a repaint..
i tried calling repaint myself but it didn't work. I have no clues what so ever. can some one help me out
Paneldeck( class which extends JPanel)
this has panels and labels
setLabel() is the function which sets the labels
Gamedeck ( class which extends Jframe )
this has panels and one of the subpanel loads the earlier class object
if i call setLabel() in the game deck constructor it works fine
if i call the setLabel() anywhere else it doesnt do its job like how i said initially..
Titus Abraham wrote:got the answer. updateUi solved the same..
I'm not sure of the exact solution to your problem without seeing code, but I can tell you that your current solution is a bad one. updateUI should most definitely not be used here. I'm guessing that you're adding components after a JFrame has been rendered and that you need to call revalidate and (possibly) then repaint on the container that holds the added components.