Drawn string (using drawString) flickers

I'm doing this project here, and I have to draw a string to prevent me some problems, the drawing works and the string updates just fine, thing is, it tends to flicker somehow. It's like it's being redrawn, and while it's acceptable to think that it needs to be redrawn due to how the values change, I'm pretty sure that it's not that idea that I can it 'flicker' as it is drawn once more.

Here's the code concerning the drawing of the string:

public void paint(Graphics g){


    g.drawString("Arca: " + administrador.getCiudad().getArca() 
    + "                                    " 
    + " Puntos de Belleza: " + administrador.getCiudad().getPuntosBelleza() + 
    "                                    " + 
    " Habitantes: " + 
    administrador.getCiudad().getCantidadHabitantes() + " / " 
    + administrador.getCiudad().getCantidadHabitantesDisponibles(), 400, 45);


If you need any more information just tell me and I'll give it to you!



Don't invoke repaint() from a painting method. You will cause an infinite loop.

Need Your Help

GoogleTest several C++ projects in the same solution

c++ visual-studio unit-testing googletest

I have e.g. 10 C++ projects in a solution SolA and want to UnitTest them with GoogleTest:

Remove node by ID in jstree when button is clicked

jquery jstree

I'm using jstree and I want to delete a specific node by its ID after a click on a button.