Tabnine Logo
BezierTool
Code IndexAdd Tabnine to your IDE (free)

How to use
BezierTool
in
org.jhotdraw.draw.tool

Best Java code snippets using org.jhotdraw.draw.tool.BezierTool (Showing top 12 results out of 315)

origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
public void mouseClicked(MouseEvent evt) {
  if (createdFigure != null) {
    switch (evt.getClickCount()) {
      case 1:
        if (createdFigure.getNodeCount() > 2) {
          Rectangle r = new Rectangle(getView().drawingToView(createdFigure.getStartPoint()));
          r.grow(2, 2);
          if (r.contains(evt.getX(), evt.getY())) {
            createdFigure.setClosed(true);
            finishCreation(createdFigure, creationView);
            createdFigure = null;
            if (isToolDoneAfterCreation) {
              fireToolDone();
            }
          }
        }
        break;
      case 2:
        finishWhenMouseReleased = null;
        finishCreation(createdFigure, creationView);
        createdFigure = null;
        break;
    }
  }
}
origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
public void mouseDragged(MouseEvent evt) {
  if (finishWhenMouseReleased == null) {
    finishWhenMouseReleased = Boolean.TRUE;
  }
  int x = evt.getX();
  int y = evt.getY();
  addPointToFigure(getView().viewToDrawing(new Point(x, y)));
}
origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
public void deactivate(DrawingEditor editor) {
  super.deactivate(editor);
  getView().setCursor(Cursor.getDefaultCursor());
  if (createdFigure != null) {
    if (anchor != null && mouseLocation != null) {
      Rectangle r = new Rectangle(anchor);
      r.add(mouseLocation);
      if (createdFigure.getNodeCount() > 0 && createdFigure.isClosed()) {
        r.add(getView().drawingToView(createdFigure.getStartPoint()));
      }
      fireAreaInvalidated(r);
    }
    finishCreation(createdFigure, creationView);
    createdFigure = null;
  }
}
origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

protected void finishCreation(BezierFigure createdFigure, DrawingView creationView) {
  fireUndoEvent(createdFigure, creationView);
  creationView.addToSelection(createdFigure);
  if (isToolDoneAfterCreation) {
    fireToolDone();
  }
}
origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

  r.add(evt.getPoint());
  r.grow(1, 1);
  fireAreaInvalidated(r);
if (createdFigure != null && creationView != getView()) {
  finishCreation(createdFigure, creationView);
  createdFigure = null;
  creationView = getView();
  creationView.clearSelection();
  finishWhenMouseReleased = null;
  createdFigure = createFigure();
  createdFigure.addNode(new BezierPath.Node(
      creationView.getConstrainer().constrainPoint(
      creationView.viewToDrawing(anchor))));
  getDrawing().add(createdFigure);
} else {
  if (evt.getClickCount() == 1) {
    addPointToFigure(creationView.getConstrainer().constrainPoint(
        creationView.viewToDrawing(anchor)));
origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

    figurePath.remove(nodeCountBeforeDrag - 1);
  BezierPath fittedPath = calculateFittedCurve(digitizedPath);
    Rectangle r = new Rectangle(anchor.x, anchor.y, 0, 0);
    r.add(evt.getX(), evt.getY());
    maybeFireBoundsInvalidated(r);
    finishCreation(createdFigure, creationView);
    createdFigure = null;
    finishWhenMouseReleased = null;
r.add(evt.getPoint());
r.grow(1, 1);
fireAreaInvalidated(r);
anchor.x = evt.getX();
anchor.y = evt.getY();
origin: net.imagej/imagej-ui-swing

@Override
protected void finishCreation(final BezierFigure figure,
  final DrawingView drawingView)
{
  super.finishCreation(figure, drawingView);
  final JHotDrawService jHotDrawService =
    getDisplay().getContext().getService(JHotDrawService.class);
  jHotDrawService.linkOverlay(figure, getAdapter(), getDisplay());
}
origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

lc = cnt.getPrototype();
lc.setLiner(new CurvedLiner());
ButtonFactory.addToolTo(tb, editor, new BezierTool(new BezierFigure()), "edit.createScribble", labels);
ButtonFactory.addToolTo(tb, editor, new BezierTool(new BezierFigure(true)), "edit.createPolygon", labels);
ButtonFactory.addToolTo(tb, editor, new TextCreationTool(new TextFigure()), "edit.createText", labels);
ButtonFactory.addToolTo(tb, editor, new TextAreaCreationTool(new TextAreaFigure()), "edit.createTextArea", labels);
origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

protected void fireUndoEvent(Figure createdFigure, DrawingView creationView) {
  final Figure addedFigure = createdFigure;
  final Drawing addedDrawing = creationView.getDrawing();
  final DrawingView addedView = creationView;
  getDrawing().fireUndoableEditHappened(new AbstractUndoableEdit() {
    @Override
    public String getPresentationName() {
      return presentationName;
    }
    @Override
    public void undo() throws CannotUndoException {
      super.undo();
      addedDrawing.remove(addedFigure);
    }
    @Override
    public void redo() throws CannotRedoException {
      super.redo();
      addedView.clearSelection();
      addedDrawing.add(addedFigure);
      addedView.addToSelection(addedFigure);
    }
  });
}
origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
public void mouseMoved(MouseEvent evt) {
  if (createdFigure != null && anchor != null && mouseLocation != null) {
    if (evt.getSource() == creationView) {
      Rectangle r = new Rectangle(anchor);
      r.add(mouseLocation);
      r.add(evt.getPoint());
      if (createdFigure.isClosed() && createdFigure.getNodeCount() > 0) {
        r.add(creationView.drawingToView(createdFigure.getStartPoint()));
      }
      r.grow(1, 1);
      fireAreaInvalidated(r);
      mouseLocation = evt.getPoint();
    }
  }
}
origin: net.imagej/ij-ui-swing

@Override
protected void finishCreation(final BezierFigure figure,
  final DrawingView drawingView)
{
  super.finishCreation(figure, drawingView);
  final JHotDrawService jHotDrawService =
    getDisplay().getContext().getService(JHotDrawService.class);
  jHotDrawService.linkOverlay(figure, getAdapter(), getDisplay());
}
origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

lc = cnt.getPrototype();
lc.setLiner(new CurvedLiner());
ButtonFactory.addToolTo(tb, editor, new BezierTool(new BezierFigure()), "edit.createScribble", labels);
ButtonFactory.addToolTo(tb, editor, new BezierTool(new BezierFigure(true)), "edit.createPolygon", labels);
ButtonFactory.addToolTo(tb, editor, new TextCreationTool(new TextFigure()), "edit.createText", labels);
ButtonFactory.addToolTo(tb, editor, new TextAreaCreationTool(new TextAreaFigure()), "edit.createTextArea", labels);
org.jhotdraw.draw.toolBezierTool

Javadoc

A Tool which allows to create a new BezierFigure by drawing its path.

Most used methods

  • finishCreation
  • <init>
  • addPointToFigure
  • calculateFittedCurve
  • createFigure
  • fireAreaInvalidated
  • fireToolDone
  • fireUndoEvent
  • getDrawing
  • getEditor
  • getView
  • maybeFireBoundsInvalidated
  • getView,
  • maybeFireBoundsInvalidated

Popular in Java

  • Making http post requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • putExtra (Intent)
  • runOnUiThread (Activity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now