A我自己写的connection连线算法Connection————3

for (int a = z + 1; a <= 16; a++) {
if (((ChipTrough) map.get(a)).isSaveCome()) {
x = ((ChipTrough) map.get(a)).getXy().getX();
y = ((ChipTrough) map.get(a)).getXy().getY();
// 芯片
node = new Chip(outputRole, inputRole, null, null,
bd);
chipLabel = new ChipFont(chipName, node);
node.setBackgroundColor(ColorConstants.black);
node.setBounds(new Rectangle(x + 14, y + 12, 115,
115));
node.setBorder(new FocusBorder());

// 边框
bd.setBackgroundColor(ColorConstants.darkGreen);
bd.setBounds(new Rectangle(x, y, 135, 135));

// 银角
outputRole.setBounds(new Rectangle(x + 8, node
.getBounds().y + 2, 20, 10));
inputRole.setBounds(new Rectangle(x + 8, node
.getBounds().y + 20, 20, 10));

inputRole.setBackgroundColor(ColorConstants.yellow);
outputRole.setBackgroundColor(ColorConstants.cyan);

//银角名字对象的设置
outputRoleName.setForegroundColor(ColorConstants.black);
outputRoleName.setBounds(new Rectangle(outputRole.getBounds().x+9, outputRole.getBounds().y, 8, 10));
inputRoleName.setForegroundColor(ColorConstants.black);
inputRoleName.setBounds(new Rectangle(inputRole.getBounds().x+9, inputRole.getBounds().y, 8, 10));

// 名字
chipLabel.setForegroundColor(ColorConstants.white);
chipLabel.setFont(fontRegistry.getItalic(FONT_ONE));
chipLabel.setBounds(new Rectangle(x + 20, y + 15,
115, 115));
//
((ChipTrough) map.get(a)).setSaveCome(false);
// break 是中断循环 不再判断下一个芯片槽是否有芯片 因为这个要增加的芯片已经增加
break;
} else {
// 继续循环 因为下个芯片槽还是存在芯片
continue;
}

}
}

panel.add(bd);
panel.add(node);
panel.add(outputRole);
panel.add(inputRole);
panel.add(chipLabel);
panel.add(inputRoleName);
panel.add(outputRoleName);

new Dragger(chipLabel);
new Dragger(outputRole);
new Dragger(inputRole);
new Dragger(panel);
}

});
b1.setBounds(new Rectangle(300, 0, 90, 30));

panel.add(b1);

panel.addFigureListener(new FigureListener() {

@Override
public void figureMoved(IFigure source) {
// TODO Auto-generated method stub

}
});

Display display = Display.getDefault();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值