本文整理汇总了Java中com.cburch.logisim.circuit.RadixOption.decode方法的典型用法代码示例。如果您正苦于以下问题:Java RadixOption.decode方法的具体用法?Java RadixOption.decode怎么用?Java RadixOption.decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cburch.logisim.circuit.RadixOption
的用法示例。
在下文中一共展示了RadixOption.decode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: 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());
}
示例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());
}