Skip to content


Repintar componentes Swing inmediatamente

Cuantas veces hemos creado un proceso que nos consume la ejecución de nuestro hilo o programa y queremos que se nos repinten algunos componentes como una barra de progreso una label o cualquier otro componente swing, pues con sólo crearnos este pequeño método y llamarlo pasándole el componente que queramos repintar lo tenemos solucionado sin tener que realizar nuevos hilos de ejecución.

private void repintar(javax.swing.JComponent componente) {
        Rectangle area = componente.getBounds();
        area.x = 0;
        area.y = 0;
        componente.paintImmediately(area);
    }

Artículos Relacionados

Posted in Java. Tagged with , , , , , , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.