String name = filename.substring(0, filename.length() - 4); if (ext.equals(SaveGraphicsService.PNG_EXTENSION)) { save.saveJComponent(name, SaveGraphicsService.PNG, comp); } else if (ext.equals(SaveGraphicsService.TIFF_EXTENSION)) { save.saveJComponent(name, SaveGraphicsService.TIFF, comp); } else { save.saveJComponent(filename, SaveGraphicsService.PNG, comp);