Skip to main content


Showing posts from October, 2014

Old Java Swing style fadeIn / fadeOut on image

As my open source project (Violet UML Editor) has a GUI developed in Swing (wich is not a problem because I massively use the Graphics2D canvas which should be portable to other tehnologies), I sometimes have to find tricks to enhance UX. That was my last challenge. I decided to implement fade effects on image. After googlings, I didn't find anything ready to use. So, I developed a quick and simple piece of code I share with you. The idea is to embed my image as an ImageIcon attached to a JLabel. Then, to trigger fade effects, I just use a mouse listener.

import java.awt.AlphaComposite;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.Timer;

public class FadeImage extends JLabel implements ActionListener {

    // Up to 1f
    private float opacity = 0f;
    private Timer fadeTimer;
    private int fadeIndicator = 1;

    public FadeImage(ImageI…

José Paumard & Rémi Forax : two Java french stars interviewed on Java 8

Rémi is one of my favorite Java superstars.
If you understand french, you should see this :
First partSecond partThird part