/** * Attempt to load a fluff image by combining elements of type and name. * * @param unit * The unit. * @return An image or {@code null}. */ protected static Image loadFluffImageHeuristic(final Entity unit) { Image fluff = null; String dir = DIR_NAME_MECH; if (unit instanceof Aero) { dir = DIR_NAME_AERO; } else if (unit instanceof BattleArmor) { dir = DIR_NAME_BA; } else if (unit instanceof Tank) { dir = DIR_NAME_VEHICLE; } File fluff_image_file = findFluffImage( new MegaMekFile(Configuration.fluffImagesDir(), dir).getFile(), unit); if (fluff_image_file != null) { fluff = new ImageIcon(fluff_image_file.toString()).getImage(); } return fluff; }