che errore ti da?

Per sapere se l'oggetto è una jlabel:

if(namelabels.get(x) instanceof JLabel)
...