Skip to content

Instantly share code, notes, and snippets.

@HashRaygoza
Created August 4, 2020 15:45
Show Gist options
  • Save HashRaygoza/f7c3609f8156851efdc998bd2750539d to your computer and use it in GitHub Desktop.
Save HashRaygoza/f7c3609f8156851efdc998bd2750539d to your computer and use it in GitHub Desktop.
public class EventoOperacionRapida implements ActionListener {
private JProgressBar barra;
Integer valor = 0;
Boolean direccion = true;
public EventoOperacionRapida(JProgressBar b) {
barra = b;
}
@Override
public void actionPerformed(ActionEvent e) {
if(valor == 100) {
direccion = false;
}
if(valor == 0){
direccion = true;
}
if(direccion == true) {
valor++;
} else {
valor--;
}
System.out.println(valor + " de 100");
barra.setValue(valor);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment