當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。