本文整理匯總了Java中org.jhotdraw.draw.handle.Handle.getDrawingArea方法的典型用法代碼示例。如果您正苦於以下問題:Java Handle.getDrawingArea方法的具體用法?Java Handle.getDrawingArea怎麽用?Java Handle.getDrawingArea使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jhotdraw.draw.handle.Handle
的用法示例。
在下文中一共展示了Handle.getDrawingArea方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addToSelection
import org.jhotdraw.draw.handle.Handle; //導入方法依賴的package包/類
/**
* Adds a figure to the current selection.
*/
@Override
public void addToSelection(Figure figure) {
if (DEBUG) {
System.out.println("DefaultDrawingView" + ".addToSelection(" + figure + ")");
}
Set<Figure> oldSelection = new HashSet<Figure>(selectedFigures);
if (selectedFigures.add(figure)) {
figure.addFigureListener(handleInvalidator);
Set<Figure> newSelection = new HashSet<Figure>(selectedFigures);
Rectangle invalidatedArea = null;
if (handlesAreValid && getEditor() != null) {
for (Handle h : figure.createHandles(detailLevel)) {
h.setView(this);
selectionHandles.add(h);
h.addHandleListener(eventHandler);
if (invalidatedArea == null) {
invalidatedArea = h.getDrawingArea();
} else {
invalidatedArea.add(h.getDrawingArea());
}
}
}
fireSelectionChanged(oldSelection, newSelection);
if (invalidatedArea != null) {
repaint(invalidatedArea);
}
}
}
示例2: validateHandles
import org.jhotdraw.draw.handle.Handle; //導入方法依賴的package包/類
/**
* Validates the handles.
*/
private void validateHandles() {
// Validate handles only, if they are invalid, and if
// the DrawingView has a DrawingEditor.
if (!handlesAreValid && getEditor() != null) {
handlesAreValid = true;
selectionHandles.clear();
Rectangle invalidatedArea = null;
while (true) {
for (Figure figure : getSelectedFigures()) {
for (Handle handle : figure.createHandles(detailLevel)) {
handle.setView(this);
selectionHandles.add(handle);
handle.addHandleListener(eventHandler);
if (invalidatedArea == null) {
invalidatedArea = handle.getDrawingArea();
} else {
invalidatedArea.add(handle.getDrawingArea());
}
}
}
if (selectionHandles.size() == 0 && detailLevel != 0) {
// No handles are available at the desired detail level.
// Retry with detail level 0.
detailLevel = 0;
continue;
}
break;
}
if (invalidatedArea != null) {
repaint(invalidatedArea);
}
}
}
示例3: validateHandles
import org.jhotdraw.draw.handle.Handle; //導入方法依賴的package包/類
/**
* Validates the handles.
*/
protected void validateHandles() {
// Validate handles only, if they are invalid, and if
// the DrawingView has a DrawingEditor.
if (!handlesAreValid && getEditor() != null) {
handlesAreValid = true;
selectionHandles.clear();
Rectangle invalidatedArea = null;
while (true) {
for (Figure figure : getSelectedFigures()) {
for (Handle handle : figure.createHandles(detailLevel)) {
handle.setView(this);
selectionHandles.add(handle);
handle.addHandleListener(eventHandler);
if (invalidatedArea == null) {
invalidatedArea = handle.getDrawingArea();
} else {
invalidatedArea.add(handle.getDrawingArea());
}
}
}
if (selectionHandles.size() == 0 && detailLevel != 0) {
// No handles are available at the desired detail level.
// Retry with detail level 0.
detailLevel = 0;
continue;
}
break;
}
if (invalidatedArea != null) {
repaint(invalidatedArea);
}
}
}