Source: https://lipn.univ-paris13.fr/~recanati/docs/M1-ProgJava/JavaSwing1.pdf