private void addCreationButtonsTo(JToolBar tb, DrawingEditor editor) { addDefaultCreationButtonsTo( tb, editor, ButtonFactory.createDrawingActions(editor), ButtonFactory.createSelectionActions(editor)); }
private void addCreationButtonsTo(JToolBar tb, final DrawingEditor editor) { // AttributeKeys for the entitie sets HashMap<AttributeKey, Object> attributes; ResourceBundleUtil drawLabels = ResourceBundleUtil.getBundle("org.jhotdraw.draw.Labels"); ButtonFactory.addSelectionToolTo( tb, editor, ButtonFactory.createDrawingActions(editor), createSelectionActions(editor)); tb.addSeparator(); attributes = new HashMap<AttributeKey, Object>(); attributes.put(AttributeKeys.FILL_COLOR, Color.white); attributes.put(AttributeKeys.STROKE_COLOR, Color.black); ButtonFactory.addToolTo( tb, editor, new CreationTool(new SVGRectFigure(), attributes), "edit.createRectangle", drawLabels); ButtonFactory.addToolTo( tb, editor, new CreationTool(new SVGEllipseFigure(), attributes), "edit.createEllipse", drawLabels); ButtonFactory.addToolTo( tb, editor, new PathTool(new SVGPathFigure(), new SVGBezierFigure(true), attributes), "edit.createPolygon", drawLabels); attributes = new HashMap<AttributeKey, Object>(); attributes.put(AttributeKeys.FILL_COLOR, null); attributes.put(AttributeKeys.STROKE_COLOR, Color.black); ButtonFactory.addToolTo( tb, editor, new CreationTool(new SVGPathFigure(), attributes), "edit.createLine", drawLabels); ButtonFactory.addToolTo( tb, editor, new PathTool(new SVGPathFigure(), new SVGBezierFigure(false), attributes), "edit.createScribble", drawLabels); attributes = new HashMap<AttributeKey, Object>(); attributes.put(AttributeKeys.FILL_COLOR, Color.black); attributes.put(AttributeKeys.STROKE_COLOR, null); ButtonFactory.addToolTo( tb, editor, new CreationTool(new SVGTextFigure(), attributes), "edit.createText", drawLabels); TextAreaCreationTool tat = new TextAreaCreationTool(new SVGTextAreaFigure(), attributes); tat.setRubberbandColor(Color.BLACK); ButtonFactory.addToolTo(tb, editor, tat, "edit.createTextArea", drawLabels); }