I am currently having a minor issue with a Java Jframe and a button not updating.
I am trying to disable the Print Button until the printing of the new JFrame it opens is done and that JFrame is closed…
The button will only disable if and when a new window occurs, but will not until then, which can take a little bit of time….
I set the button to disable by doing this: PrintBttn.setEnabled(false);
I have tried calling mainPanel.revalidate(); mainPanel.repaint(); PrintBttn.revalidate(); PrintBttn.repaint as well as a mixture of the above as they recommended in other forums…
I am kind of lost at the moment on this and to why it is not disabling the button until a new window appears since the first thing i do is Disable it as shown above, and then go through and create the new window….
Thanks,
Erik
Most likely, it’s a question of releasing the EDT to allow it to repaint the disabled button.
Generally, it will look something like this: