本文整理汇总了Java中com.cburch.logisim.circuit.appear.AppearancePort类的典型用法代码示例。如果您正苦于以下问题:Java AppearancePort类的具体用法?Java AppearancePort怎么用?Java AppearancePort使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppearancePort类属于com.cburch.logisim.circuit.appear包,在下文中一共展示了AppearancePort类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldShowPopup
import com.cburch.logisim.circuit.appear.AppearancePort; //导入依赖的package包/类
private Set<AppearancePort> shouldShowPopup(Collection<CanvasObject> add) {
boolean found = false;
for (CanvasObject o : add) {
if (o instanceof AppearancePort) {
found = true;
break;
}
}
if (found) {
Set<AppearancePort> ports = getSelectedPorts();
if (!ports.isEmpty() && isPortUnselected(ports)) {
return ports;
}
}
return null;
}
示例2: showPopup
import com.cburch.logisim.circuit.appear.AppearancePort; //导入依赖的package包/类
private void showPopup(Set<AppearancePort> portObjects) {
dragStart = null;
CircuitState circuitState = canvas.getCircuitState();
if (circuitState == null)
return;
ArrayList<Instance> ports = new ArrayList<Instance>(portObjects.size());
for (AppearancePort portObject : portObjects) {
ports.add(portObject.getPin());
}
hideCurrentPopup();
LayoutThumbnail layout = new LayoutThumbnail();
layout.setCircuit(circuitState, ports);
JViewport owner = canvasPane.getViewport();
Point ownerLoc = owner.getLocationOnScreen();
Dimension ownerDim = owner.getSize();
Dimension layoutDim = layout.getPreferredSize();
int x = ownerLoc.x + Math.max(0, ownerDim.width - layoutDim.width - 5);
int y = ownerLoc.y + Math.max(0, ownerDim.height - layoutDim.height - 5);
PopupFactory factory = PopupFactory.getSharedInstance();
Popup popup = factory.getPopup(canvasPane.getViewport(), layout, x, y);
popup.show();
curPopup = popup;
curPopupTime = System.currentTimeMillis();
}
示例3: showPopup
import com.cburch.logisim.circuit.appear.AppearancePort; //导入依赖的package包/类
private void showPopup(Set<AppearancePort> portObjects) {
dragStart = null;
CircuitState circuitState = canvas.getCircuitState();
if (circuitState == null)
return;
ArrayList<Instance> ports = new ArrayList<Instance>(portObjects.size());
for (AppearancePort portObject : portObjects) {
ports.add(portObject.getPin());
}
hideCurrentPopup();
LayoutThumbnail layout = new LayoutThumbnail();
layout.setCircuit(circuitState, ports);
JViewport owner = canvasPane.getViewport();
Point ownerLoc = owner.getLocationOnScreen();
Dimension ownerDim = owner.getSize();
Dimension layoutDim = layout.getPreferredSize();
int x = ownerLoc.x + Math.max(0, ownerDim.width - layoutDim.width - 5);
int y = ownerLoc.y
+ Math.max(0, ownerDim.height - layoutDim.height - 5);
PopupFactory factory = PopupFactory.getSharedInstance();
Popup popup = factory.getPopup(canvasPane.getViewport(), layout, x, y);
popup.show();
curPopup = popup;
curPopupTime = System.currentTimeMillis();
}
示例4: showPopup
import com.cburch.logisim.circuit.appear.AppearancePort; //导入依赖的package包/类
private void showPopup(Set<AppearancePort> portObjects) {
dragStart = null;
CircuitState circuitState = canvas.getCircuitState();
if (circuitState == null) return;
ArrayList<Instance> ports = new ArrayList<Instance>(portObjects.size());
for (AppearancePort portObject : portObjects) {
ports.add(portObject.getPin());
}
hideCurrentPopup();
LayoutThumbnail layout = new LayoutThumbnail();
layout.setCircuit(circuitState, ports);
JViewport owner = canvasPane.getViewport();
Point ownerLoc = owner.getLocationOnScreen();
Dimension ownerDim = owner.getSize();
Dimension layoutDim = layout.getPreferredSize();
int x = ownerLoc.x + Math.max(0, ownerDim.width - layoutDim.width - 5);
int y = ownerLoc.y + Math.max(0, ownerDim.height - layoutDim.height - 5);
PopupFactory factory = PopupFactory.getSharedInstance();
Popup popup = factory.getPopup(canvasPane.getViewport(), layout, x, y);
popup.show();
curPopup = popup;
curPopupTime = System.currentTimeMillis();
}
示例5: getSelectedPorts
import com.cburch.logisim.circuit.appear.AppearancePort; //导入依赖的package包/类
private Set<AppearancePort> getSelectedPorts() {
HashSet<AppearancePort> ports = new HashSet<AppearancePort>();
for (CanvasObject o : canvas.getSelection().getSelected()) {
if (o instanceof AppearancePort) {
ports.add((AppearancePort) o);
}
}
return ports;
}
示例6: isPortUnselected
import com.cburch.logisim.circuit.appear.AppearancePort; //导入依赖的package包/类
private boolean isPortUnselected(Set<AppearancePort> selected) {
for (CanvasObject o : canvas.getModel().getObjectsFromBottom()) {
if (o instanceof AppearancePort) {
if (!selected.contains(o)) {
return true;
}
}
}
return false;
}
示例7: selectionChanged
import com.cburch.logisim.circuit.appear.AppearancePort; //导入依赖的package包/类
@Override
public void selectionChanged(SelectionEvent e) {
int act = e.getAction();
if (act == SelectionEvent.ACTION_ADDED) {
Set<AppearancePort> ports = shouldShowPopup(e.getAffected());
if (ports == null) {
hideCurrentPopup();
} else {
showPopup(ports);
}
}
}
示例8: selectionChanged
import com.cburch.logisim.circuit.appear.AppearancePort; //导入依赖的package包/类
public void selectionChanged(SelectionEvent e) {
int act = e.getAction();
if (act == SelectionEvent.ACTION_ADDED) {
Set<AppearancePort> ports = shouldShowPopup(e.getAffected());
if (ports == null) {
hideCurrentPopup();
} else {
showPopup(ports);
}
}
}