/** Creates the tool palette. */
 protected JToolBar createToolPalette() {
   JToolBar palette = new JToolBar();
   palette.setBackground(Color.lightGray);
   // use standard FlowLayout for JToolBar
   // palette.setLayout(new PaletteLayout(2,new Point(2,2)));
   return palette;
 }
 /**
  * Creates the tools. By default only the selection tool is added. Override this method to add
  * additional tools. Call the inherited method to include the selection tool.
  *
  * @param palette the palette where the tools are added.
  */
 protected void createTools(JToolBar palette) {
   Tool tool = createSelectionTool();
   fDefaultToolButton = createToolButton(IMAGES + "SEL", "Selection Tool", tool);
   palette.add(fDefaultToolButton);
 }
示例#3
0
  protected void createTools(JToolBar palette) {
    super.createTools(palette);

    Tool tool = new UndoableTool(new TextTool(this, new TextFigure()));
    palette.add(createToolButton(IMAGES + "TEXT", "Text Tool", tool));

    tool = new UndoableTool(new ConnectedTextTool(this, new TextFigure()));
    palette.add(createToolButton(IMAGES + "ATEXT", "Connected Text Tool", tool));

    tool = new URLTool(this);
    palette.add(createToolButton(IMAGES + "URL", "URL Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new RectangleFigure()));
    palette.add(createToolButton(IMAGES + "RECT", "Rectangle Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new RoundRectangleFigure()));
    palette.add(createToolButton(IMAGES + "RRECT", "Round Rectangle Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new EllipseFigure()));
    palette.add(createToolButton(IMAGES + "ELLIPSE", "Ellipse Tool", tool));

    tool = new UndoableTool(new PolygonTool(this));
    palette.add(createToolButton(IMAGES + "POLYGON", "Polygon Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new TriangleFigure()));
    palette.add(createToolButton(IMAGES + "TRIANGLE", "Triangle Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new DiamondFigure()));
    palette.add(createToolButton(IMAGES + "DIAMOND", "Diamond Tool", tool));

    tool = new UndoableTool(new CreationTool(this, new LineFigure()));
    palette.add(createToolButton(IMAGES + "LINE", "Line Tool", tool));

    tool = new UndoableTool(new ConnectionTool(this, new LineConnection()));
    palette.add(createToolButton(IMAGES + "CONN", "Connection Tool", tool));

    tool = new UndoableTool(new ConnectionTool(this, new ElbowConnection()));
    palette.add(createToolButton(IMAGES + "OCONN", "Elbow Connection Tool", tool));

    tool = new UndoableTool(new ScribbleTool(this));
    palette.add(createToolButton(IMAGES + "SCRIBBL", "Scribble Tool", tool));

    tool = new UndoableTool(new BorderTool(this));
    palette.add(createToolButton(IMAGES + "BORDDEC", "Border Tool", tool));
  }