You initialize your array of JLabel
s:
private JLabel[] labels = new JLabel[3];
But you never fill this array with values, so they will be null
when you want to access them. Set each element with new JLabel()
and they won't be null
when you need them.