当前位置: 首页>>代码示例>>Java>>正文


Java Figure类代码示例

本文整理汇总了Java中org.jhotdraw.draw.Figure的典型用法代码示例。如果您正苦于以下问题:Java Figure类的具体用法?Java Figure怎么用?Java Figure使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Figure类属于org.jhotdraw.draw包,在下文中一共展示了Figure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BoundsOutlineHandle

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
/**
 * Creates a bounds outline handle for resizing or transforming a component.
 *
 * @param owner
 */
public BoundsOutlineHandle(Figure owner, //
        AttributeKey<Stroke> stroke1Enabled, AttributeKey<Color> strokeColor1Enabled,//
        AttributeKey<Stroke> stroke2Enabled, AttributeKey<Color> strokeColor2Enabled,//
        AttributeKey<Stroke> stroke1Disabled, AttributeKey<Color> strokeColor1Disabled,//
        AttributeKey<Stroke> stroke2Disabled, AttributeKey<Color> strokeColor2Disabled
        ) {
    super(owner);
    this.stroke1Enabled = stroke1Enabled;
    this.strokeColor1Enabled = strokeColor1Enabled;
    this.stroke2Enabled = stroke2Enabled;
    this.strokeColor2Enabled = strokeColor2Enabled;
    this.stroke1Disabled = stroke1Disabled;
    this.strokeColor1Disabled = strokeColor1Disabled;
    this.stroke2Disabled = stroke2Disabled;
    this.strokeColor2Disabled = strokeColor2Disabled;
    }
 
开发者ID:umple,项目名称:umple,代码行数:22,代码来源:BoundsOutlineHandle.java

示例2: actionPerformed

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
    CompositeEdit edit;
    AffineTransform tx = new AffineTransform();
    tx.translate(dx, dy);

    HashSet<Figure> transformedFigures = new HashSet<Figure>();
    for (Figure f : getView().getSelectedFigures()) {
        if (f.isTransformable()) {
            transformedFigures.add(f);
            f.willChange();
            f.transform(tx);
            f.changed();
        }
    }
    fireUndoableEditHappened(new TransformEdit(transformedFigures, tx));

}
 
开发者ID:umple,项目名称:umple,代码行数:19,代码来源:MoveAction.java

示例3: alignFigures

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
@Override
protected void alignFigures(Collection selectedFigures, Rectangle2D.Double selectionBounds) {
    double y = selectionBounds.y;
    for (Iterator i=getView().getSelectedFigures().iterator(); i.hasNext(); ) {
        Figure f = (Figure) i.next();
        if (f.isTransformable()) {
        f.willChange();
        Rectangle2D.Double b = f.getBounds();
        AffineTransform tx = new AffineTransform();
        tx.translate(0, y - b.y);
        f.transform(tx);
         f.changed();
        fireUndoableEditHappened(new TransformEdit(f, tx));
        }
   }
}
 
开发者ID:umple,项目名称:umple,代码行数:17,代码来源:AlignAction.java

示例4: selectionChanged

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
/**
 * Responds to the JHotDraw figure selection event by selecting and
 * deselecting views whose state has changed.
 * 
 * @param event Event indicating that the figure selections have changed.
 */
@Override
public void selectionChanged(FigureSelectionEvent event) {
	final Set<Figure> newSelection = event.getNewSelection();
	final Set<Figure> oldSelection = event.getOldSelection();
	for (final DataView view : getDisplay()) {
		final FigureView figureView = getFigureView(view);
		if (figureView != null) {
			final Figure figure = figureView.getFigure();
			if (newSelection.contains(figure)) {
				view.setSelected(true);
			}
			else if (oldSelection.contains(figure)) {
				view.setSelected(false);
			}
		}
	}
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:24,代码来源:JHotDrawImageCanvas.java

示例5: selectAll

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
/**
 * Selects all selectable figures.
 */
@Override
public void selectAll() {
    Set<Figure> oldSelection = new HashSet<Figure>(selectedFigures);
    selectedFigures.clear();

    for (Figure figure : drawing.getChildren()) {
        if (figure.isSelectable()) {
            selectedFigures.add(figure);
        }

    }

    Set<Figure> newSelection = new HashSet<Figure>(selectedFigures);
    invalidateHandles();

    fireSelectionChanged(oldSelection, newSelection);
    repaint();

}
 
开发者ID:fjug,项目名称:IDDEA,代码行数:23,代码来源:InteractiveDrawingView.java

示例6: getCompatibleHandles

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
/**
 * Gets compatible handles.
 * @return A collection containing the handle and all compatible handles.
 */
@Override
public Collection<Handle> getCompatibleHandles(Handle master) {
    validateHandles();

    HashSet<Figure> owners = new HashSet<Figure>();
    LinkedList<Handle> compatibleHandles = new LinkedList<Handle>();
    owners.add(master.getOwner());
    compatibleHandles.add(master);

    for (Handle handle : getSelectionHandles()) {
        if (!owners.contains(handle.getOwner()) && handle.isCombinableWith(master)) {
            owners.add(handle.getOwner());
            compatibleHandles.add(handle);
        }

    }
    return compatibleHandles;

}
 
开发者ID:fjug,项目名称:IDDEA,代码行数:24,代码来源:InteractiveDrawingView.java

示例7: undo

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
@Override
public void undo() throws CannotRedoException {
    super.undo();
    Iterator<Object> di = editUndoData.iterator();
    for (Figure f : editedFigures) {
        f.willChange();
        f.restoreAttributesTo(di.next());
        f.changed();
    }
}
 
开发者ID:umple,项目名称:umple,代码行数:11,代码来源:AbstractAttributeEditorHandler.java

示例8: redo

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
@Override
public void redo() throws CannotRedoException {
    super.redo();
    for (Figure f : editedFigures) {
        f.set(attributeKey, editRedoValue);
    }
}
 
开发者ID:umple,项目名称:umple,代码行数:8,代码来源:AbstractAttributeEditorHandler.java

示例9: getEditedFigures

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
@Override
protected Set<Figure> getEditedFigures() {
    HashSet<Figure> s = new HashSet<Figure>();
    if (drawing != null) {
        s.add(drawing);
    } else if (activeView != null) {
        s.add(activeView.getDrawing());
    }
    return s;
}
 
开发者ID:umple,项目名称:umple,代码行数:11,代码来源:DrawingAttributeEditorHandler.java

示例10: selectSame

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
public void selectSame() {
    HashSet<Class> selectedClasses = new HashSet<Class>();
    for (Figure selected : getView().getSelectedFigures()) {
        selectedClasses.add(selected.getClass());
    }
    for (Figure f : getDrawing().getChildren()) {
        if (selectedClasses.contains(f.getClass())) {
            getView().addToSelection(f);
        }
    }
}
 
开发者ID:umple,项目名称:umple,代码行数:12,代码来源:SelectSameAction.java

示例11: getSelectionBounds

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
/**
 * Returns the bounds of the selected figures.
 */
protected Rectangle2D.Double getSelectionBounds() {
    Rectangle2D.Double bounds = null;
    for (Iterator i=getView().getSelectedFigures().iterator(); i.hasNext(); ) {
        Figure f = (Figure) i.next();
        if (bounds == null) {
            bounds = f.getBounds();
        } else {
            bounds.add(f.getBounds());
        }
    }
    return bounds;
}
 
开发者ID:umple,项目名称:umple,代码行数:16,代码来源:AlignAction.java

示例12: FigureCreatedEvent

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
public FigureCreatedEvent(final OverlayView view, final Figure figure,
	final ImageDisplay display)
{
	super(view);
	this.view = view;
	this.figure = figure;
	this.display = display;
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:9,代码来源:FigureCreatedEvent.java

示例13: createDefaultFigure

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
@Override
public Figure createDefaultFigure() {
	final ImageFigure figure = new ImageFigure();
	figure.setTransformable(false);
	initDefaultSettings(figure);
	return figure;
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:8,代码来源:DefaultJHotDrawAdapter.java

示例14: createDefaultFigure

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
@Override
public Figure createDefaultFigure() {
	final BezierFigure figure = new PolygonFigure();
	initDefaultSettings(figure);
	figure.set(AttributeKeys.WINDING_RULE, AttributeKeys.WindingRule.EVEN_ODD);
	return figure;
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:8,代码来源:PolygonJHotDrawAdapter.java

示例15: getAdapter

import org.jhotdraw.draw.Figure; //导入依赖的package包/类
/**
 * Gets the first available adapter for the given overlay.
 * 
 * @param overlay the overlay to adapt
 * @param figure the figure to be associated with the overlay
 * @return the highest-priority adapter that supports the overlay adapted to
 *         the figure
 */
public JHotDrawAdapter<?> getAdapter(final Overlay overlay,
	final Figure figure)
{
	for (final JHotDrawAdapter<?> adapter : adapters()) {
		if (adapter.supports(overlay, figure)) return adapter;
	}
	return null;
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:17,代码来源:JHotDrawService.java


注:本文中的org.jhotdraw.draw.Figure类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。