fd.setFilenameFilter(new FilenameFilter() { public boolean accept(File dir, String name) { return (null != name && name.endsWith(".png")); } });   fd.setDirectory(".");   String fileName = null; if (null != curfile && curfile.length() > 0) { fileName = curfile.toUpperCase(); if (fileName.endsWith(".BOARD")) { int length = fileName.length(); fileName = fileName.substring (0, length-6); } fileName = fileName.toLowerCase() + ".png"; fd.setFile (fileName); }
    public void boardSaveAsImage() {        FileDialog fd = new FileDialog(frame, "Save Board As Image...", FileDialog.SAVE);        //        fd.setDirectory("data" + File.separator + "boards");        fd.setLocation(frame.getLocation().x + 150, frame.getLocation().y + 100);        fd.show();        if(fd.getFile() == null) {            // I want a file, y'know!            return;        }        curpath = fd.getDirectory();        curfileImage = fd.getFile();        // make sure the file ends in board        if (!curfileImage.toLowerCase().endsWith(".png")) {            curfileImage += ".png";        }        frame.setTitle("MegaMek Board Editor : " + curfileImage);        boardSaveImage();    }