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


Java RadixOption类代码示例

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


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

示例1: getValue

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
public <E> E getValue(Attribute<E> attr) {
	if (attr == StdAttr.FACING)
		return (E) facing;
	if (attr == StdAttr.LABEL)
		return (E) label;
	if (attr == Pin.ATTR_LABEL_LOC)
		return (E) labelloc;
	if (attr == StdAttr.LABEL_FONT)
		return (E) labelfont;
	if (attr == RadixOption.ATTRIBUTE)
		return (E) radix;
	if (attr == StdAttr.ATTR_LABEL_COLOR)
		return (E) labelColor;
	return null;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:17,代码来源:ProbeAttributes.java

示例2: setValue

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
public <V> void setValue(Attribute<V> attr, V value) {
	if (attr == StdAttr.FACING) {
		facing = (Direction) value;
	} else if (attr == StdAttr.LABEL) {
		label = (String) value;
	} else if (attr == Pin.ATTR_LABEL_LOC) {
		labelloc = (Direction) value;
	} else if (attr == StdAttr.LABEL_FONT) {
		labelfont = (Font) value;
	} else if (attr == RadixOption.ATTRIBUTE) {
		radix = (RadixOption) value;
	} else if (attr == StdAttr.ATTR_LABEL_COLOR) {
		labelColor = (Color) value;
	} else {
		throw new IllegalArgumentException("unknown attribute");
	}
	fireAttributeValueChanged(attr, value);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:20,代码来源:ProbeAttributes.java

示例3: draw

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
public void draw(Graphics g) {
	Value v = canvas.getCircuitState().getValue(wire.getEnd0());
	RadixOption radix1 = RadixOption.decode(AppPreferences.POKE_WIRE_RADIX1.get());
	RadixOption radix2 = RadixOption.decode(AppPreferences.POKE_WIRE_RADIX2.get());
	if (radix1 == null)
		radix1 = RadixOption.RADIX_2;
	String vStr = radix1.toString(v);
	if (radix2 != null && v.getWidth() > 1) {
		vStr += " / " + radix2.toString(v);
	}

	FontMetrics fm = g.getFontMetrics();
	g.setColor(caretColor);
	g.fillRect(x + 2, y + 2, fm.stringWidth(vStr) + 4, fm.getAscent() + fm.getDescent() + 4);
	g.setColor(Color.BLACK);
	g.drawRect(x + 2, y + 2, fm.stringWidth(vStr) + 4, fm.getAscent() + fm.getDescent() + 4);
	g.fillOval(x - 2, y - 2, 5, 5);
	g.drawString(vStr, x + 4, y + 4 + fm.getAscent());
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:21,代码来源:PokeTool.java

示例4: mouseReleased

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
public void mouseReleased(InstanceState state, MouseEvent e) {
	if (state.getAttributeValue(RadixOption.ATTRIBUTE) == RadixOption.RADIX_2) {
		int bit = getBit(state, e);
		if (bit == bitPressed && bit >= 0) {
			handleBitPress(state, bit, e);
		}
		bitPressed = -1;
	} else {
		PinState pinState = getState(state);
		EditText dialog = new EditText(pinState.intendedValue,
				state.getAttributeValue(RadixOption.ATTRIBUTE),
				pinState.intendedValue.getWidth());
		dialog.setLocation(e.getXOnScreen(), e.getYOnScreen());
		dialog.setVisible(true);
		// System.err.println("New Value: '" + dialog.getValue() + "'");
		pinState.intendedValue = dialog.getValue();
		state.fireInvalidated();
	}
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:21,代码来源:Pin.java

示例5: draw

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
public void draw(Graphics g) {
	Value v = canvas.getCircuitState().getValue(wire.getEnd0());
	RadixOption radix1 = RadixOption
			.decode(AppPreferences.POKE_WIRE_RADIX1.get());
	RadixOption radix2 = RadixOption
			.decode(AppPreferences.POKE_WIRE_RADIX2.get());
	if (radix1 == null)
		radix1 = RadixOption.RADIX_2;
	String vStr = radix1.toString(v);
	if (radix2 != null && v.getWidth() > 1) {
		vStr += " / " + radix2.toString(v);
	}

	FontMetrics fm = g.getFontMetrics();
	g.setColor(caretColor);
	g.fillRect(x + 2, y + 2, fm.stringWidth(vStr) + 4, fm.getAscent()
			+ fm.getDescent() + 4);
	g.setColor(Color.BLACK);
	g.drawRect(x + 2, y + 2, fm.stringWidth(vStr) + 4, fm.getAscent()
			+ fm.getDescent() + 4);
	g.fillOval(x - 2, y - 2, 5, 5);
	g.drawString(vStr, x + 4, y + 4 + fm.getAscent());
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:25,代码来源:PokeTool.java

示例6: setValue

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
public <V> void setValue(Attribute<V> attr, V value) {
	if (attr == StdAttr.FACING) {
		facing = (Direction) value;
	} else if (attr == StdAttr.LABEL) {
		label = (String) value;
	} else if (attr == Pin.ATTR_LABEL_LOC) {
		labelloc = (Direction) value;
	} else if (attr == StdAttr.LABEL_FONT) {
		labelfont = (Font) value;
	} else if (attr == RadixOption.ATTRIBUTE) {
		radix = (RadixOption) value;
	} else {
		throw new IllegalArgumentException("unknown attribute");
	}
	fireAttributeValueChanged(attr, value);
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:18,代码来源:ProbeAttributes.java

示例7: draw

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
public void draw(Graphics g) {
	Value v = canvas.getCircuitState().getValue(wire.getEnd0());
	RadixOption radix1 = RadixOption.decode(AppPreferences.POKE_WIRE_RADIX1.get());
	RadixOption radix2 = RadixOption.decode(AppPreferences.POKE_WIRE_RADIX2.get());
	if (radix1 == null) radix1 = RadixOption.RADIX_2;
	String vStr = radix1.toString(v);
	if (radix2 != null && v.getWidth() > 1) {
		vStr += " / " + radix2.toString(v);
	}
	
	FontMetrics fm = g.getFontMetrics();
	g.setColor(caretColor);
	g.fillRect(x + 2, y + 2, fm.stringWidth(vStr) + 4, 
			fm.getAscent() + fm.getDescent() + 4);
	g.setColor(Color.BLACK);
	g.drawRect(x + 2, y + 2, fm.stringWidth(vStr) + 4, 
			fm.getAscent() + fm.getDescent() + 4);
	g.fillOval(x - 2, y - 2, 5, 5);
	g.drawString(vStr, x + 4, y + 4 + fm.getAscent());
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:22,代码来源:PokeTool.java

示例8: instanceAttributeChanged

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
protected void instanceAttributeChanged(Instance instance, Attribute<?> attr) {
	if (attr == Pin.ATTR_LABEL_LOC) {
		configureLabel(instance);
	} else if (attr == StdAttr.FACING || attr == RadixOption.ATTRIBUTE) {
		instance.recomputeBounds();
		configureLabel(instance);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:10,代码来源:Probe.java

示例9: LayoutOptions

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
public LayoutOptions(PreferencesFrame window) {
	super(window);
	checks = new PrefBoolean[] { new PrefBoolean(AppPreferences.PRINTER_VIEW, Strings.getter("layoutPrinterView")),
			new PrefBoolean(AppPreferences.ATTRIBUTE_HALO, Strings.getter("layoutAttributeHalo")),
			new PrefBoolean(AppPreferences.COMPONENT_TIPS, Strings.getter("layoutShowTips")),
			new PrefBoolean(AppPreferences.MOVE_KEEP_CONNECT, Strings.getter("layoutMoveKeepConnect")),
			new PrefBoolean(AppPreferences.ADD_SHOW_GHOSTS, Strings.getter("layoutAddShowGhosts")), };

	for (int i = 0; i < 2; i++) {
		RadixOption[] opts = RadixOption.OPTIONS;
		PrefOption[] items = new PrefOption[opts.length];
		for (int j = 0; j < RadixOption.OPTIONS.length; j++) {
			items[j] = new PrefOption(opts[j].getSaveString(), opts[j].getDisplayGetter());
		}
		if (i == 0) {
			radix1 = new PrefOptionList(AppPreferences.POKE_WIRE_RADIX1, Strings.getter("layoutRadix1"), items);
		} else {
			radix2 = new PrefOptionList(AppPreferences.POKE_WIRE_RADIX2, Strings.getter("layoutRadix2"), items);
		}
	}
	afterAdd = new PrefOptionList(AppPreferences.ADD_AFTER, Strings.getter("layoutAddAfter"),
			new PrefOption[] {
					new PrefOption(AppPreferences.ADD_AFTER_UNCHANGED, Strings.getter("layoutAddAfterUnchanged")),
					new PrefOption(AppPreferences.ADD_AFTER_EDIT, Strings.getter("layoutAddAfterEdit")) });

	JPanel panel = new JPanel(new TableLayout(2));
	panel.add(afterAdd.getJLabel());
	panel.add(afterAdd.getJComboBox());
	panel.add(radix1.getJLabel());
	panel.add(radix1.getJComboBox());
	panel.add(radix2.getJLabel());
	panel.add(radix2.getJComboBox());

	setLayout(new TableLayout(1));
	for (int i = 0; i < checks.length; i++) {
		add(checks[i]);
	}
	add(panel);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:40,代码来源:LayoutOptions.java

示例10: keyPressed

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
public void keyPressed(KeyEvent e) {
	if (e.getKeyCode() == KeyEvent.VK_ENTER) {
		if (text.isEditValid()) {
			if (radix == RadixOption.RADIX_10_SIGNED
					|| radix == RadixOption.RADIX_10_UNSIGNED) {
				try {
					value = Value.createKnown(
							BitWidth.create(bitWidth),
							(int) Long.parseLong(text.getText()));
				} catch (NumberFormatException exception) {
					value = oldVal;
					return;
				}
			} else if (radix == RadixOption.RADIX_16) {
				value = Value.createKnown(BitWidth.create(bitWidth),
						(int) Long.parseLong(text.getText(), 16));
			} else if (radix == RadixOption.RADIX_8) {
				value = Value.createKnown(BitWidth.create(bitWidth),
						(int) Long.parseLong(text.getText(), 8));
			}
			setVisible(false);
		}
	} else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
		value = oldVal;
		setVisible(false);
	}
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:29,代码来源:Pin.java

示例11: getOffsetBounds

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
public Bounds getOffsetBounds(AttributeSet attrs) {
	Direction facing = attrs.getValue(StdAttr.FACING);
	BitWidth width = attrs.getValue(StdAttr.WIDTH);
	return Probe.getOffsetBounds(facing, width,
			attrs.getValue(RadixOption.ATTRIBUTE) /* RadixOption.RADIX_2 */);
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:8,代码来源:Pin.java

示例12: instanceAttributeChanged

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
protected void instanceAttributeChanged(Instance instance, Attribute<?> attr) {
	if (attr == ATTR_TYPE) {
		configurePorts(instance);
	} else if (attr == StdAttr.WIDTH || attr == StdAttr.FACING
			|| attr == Pin.ATTR_LABEL_LOC || attr == RadixOption.ATTRIBUTE) {
		instance.recomputeBounds();
		PinAttributes attrs = (PinAttributes) instance.getAttributeSet();
		Probe.configureLabel(instance, attrs.labelloc, attrs.facing);
	} else if (attr == Pin.ATTR_TRISTATE || attr == Pin.ATTR_PULL) {
		instance.fireInvalidated();
	}
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:14,代码来源:Pin.java

示例13: getValue

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <E> E getValue(Attribute<E> attr) {
	if (attr == StdAttr.FACING)
		return (E) facing;
	if (attr == StdAttr.LABEL)
		return (E) label;
	if (attr == Pin.ATTR_LABEL_LOC)
		return (E) labelloc;
	if (attr == StdAttr.LABEL_FONT)
		return (E) labelfont;
	if (attr == RadixOption.ATTRIBUTE)
		return (E) radix;
	return null;
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:16,代码来源:ProbeAttributes.java

示例14: getValue

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <E> E getValue(Attribute<E> attr) {
	if (attr == StdAttr.FACING) return (E) facing;
	if (attr == StdAttr.LABEL) return (E) label;
	if (attr == Pin.ATTR_LABEL_LOC) return (E) labelloc;
	if (attr == StdAttr.LABEL_FONT) return (E) labelfont;
	if (attr == RadixOption.ATTRIBUTE) return (E) radix;
	return null;
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:11,代码来源:ProbeAttributes.java

示例15: getOffsetBounds

import com.cburch.logisim.circuit.RadixOption; //导入依赖的package包/类
@Override
public Bounds getOffsetBounds(AttributeSet attrs) {
	return Probe.getOffsetBounds(attrs.getValue(StdAttr.FACING), BitWidth.ONE, RadixOption.RADIX_2);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:5,代码来源:Clock.java


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