currentBrush = new ShapeBrush(); ((ShapeBrush)currentBrush).makeQuadBrush(new Rectangle(0, 0, 1, 1));
ShapeBrush sb = new ShapeBrush(); sb.makeQuadBrush(new Rectangle(0, 0, 1, 1)); setBrush(sb);
    public MapEditor() {        // Create configuration class instance and try to parse existing        // configuration.        configuration = TiledConfiguration.getOrCreateInstance();        try {            configuration.parse("tiled.conf");        } catch (Exception e) {            System.out.println("Warning: could not load configuration file.");        }        /*        try {            Image imgPaintCursor = loadImageResource(                    "resources/cursor-pencil.png");            curPaint = Toolkit.getDefaultToolkit().createCustomCursor(                    imgPaintCursor, new Point(0,0), "paint");        } catch (Exception e) {            System.out.println("Error while loading custom cursors!");            e.printStackTrace();        }        */        curEyed = new Cursor(Cursor.CROSSHAIR_CURSOR);        curDefault = new Cursor(Cursor.DEFAULT_CURSOR);        undoStack = new UndoStack();        undoSupport = new UndoableEditSupport();        undoSupport.addUndoableEditListener(new UndoAdapter());        cursorHighlight = new SelectionLayer(1, 1);        cursorHighlight.select(0,0);        cursorHighlight.setVisible(configuration.keyHasValue(                    "tiled.cursorhighlight", 1));        mapEventAdapter = new MapEventAdapter();        currentBrush = new ShapeBrush();        ((ShapeBrush)currentBrush).makeQuadBrush(new Rectangle(0, 0, 1, 1));        // Create the actions        zoomInAction = new ZoomInAction();        zoomOutAction = new ZoomOutAction();        zoomNormalAction = new ZoomNormalAction();        undoAction = new UndoAction();        redoAction = new RedoAction();        rot90Action = new LayerTransformAction(MapLayer.ROTATE_90);        rot180Action = new LayerTransformAction(MapLayer.ROTATE_180);        rot270Action = new LayerTransformAction(MapLayer.ROTATE_270);        flipHorAction = new LayerTransformAction(MapLayer.MIRROR_HORIZONTAL);        flipVerAction = new LayerTransformAction(MapLayer.MIRROR_VERTICAL);        copyAction = new CopyAction();        pasteAction = new PasteAction();        cutAction = new CutAction();        selectAllAction = new SelectAllAction();        cancelSelectionAction = new CancelSelectionAction();        inverseAction = new InverseSelectionAction();        // Create our frame        appFrame = new JFrame("Tiled");        appFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);        appFrame.addWindowListener(new WindowAdapter() {            public void windowClosing(WindowEvent event) {                exit();            }        });        appFrame.setContentPane(createContentPane());        createMenuBar();        appFrame.setJMenuBar(menuBar);        appFrame.setSize(600, 400);        setCurrentMap(null);        updateRecent(null);        appFrame.setVisible(true);        // Load plugins        pluginLoader  = new PluginClassLoader();        try {            pluginLoader.readPlugins(null, appFrame);        } catch (Exception e) {            e.printStackTrace();            JOptionPane.showMessageDialog(appFrame,                    e.toString(), "Plugin loader",                    JOptionPane.WARNING_MESSAGE);        }    }