I have a requirement to change status bar prompt text at run-time on tab-out event.
I am using the following code for that. But I don't see the text changing dynamically.
Rather it creates another status bar object at the top and displays that. Please help.
If that's Swing or AWT, you shouldn't be using getGraphics() of a component, nor should you ever call a painting method from client code -- call repaint() instead. That said, your code snippet doesn't make much sense in isolation. To get better help sooner, post a SSCCE that clearly demonstrates your problem.
Again, if that's Swing, why aren't you using JLabel and its setText(...) method instead of messing around with custom painting? And what's a tab-out event?
There are no new questions, but there may be new answers.