- Font oldFont = gc.getFont();
- gc.setFont(new Font(oldFont.getName(), labelFontHeight, oldFont.getStyle()));
- Point textExtent = gc.textExtent(label);
- Color textColor = Preferences.current().getColor("net.mograsim.logic.ui.color.text");
- if (textColor != null)
- gc.setForeground(textColor);
- gc.drawText(label, getPosX() + (getWidth() - textExtent.x) / 2, getPosY() + (getHeight() - textExtent.y) / 2, true);
- gc.setFont(new Font(oldFont.getName(), pinNameFontHeight, oldFont.getStyle()));
- for (int i = 0; i < inputPinNames.size(); i++)
- {
- String pinName = inputPinNames.get(i);
- textExtent = gc.textExtent(pinName);
- gc.drawText(pinName, getPosX() + pinNameMargin, getPosY() + i * pinDistance + (pinDistance - textExtent.y) / 2, true);
- }
- for (int i = 0; i < outputPinNames.size(); i++)
- {
- String pinName = outputPinNames.get(i);
- textExtent = gc.textExtent(pinName);
- gc.drawText(pinName, getPosX() + width - textExtent.x - pinNameMargin,
- getPosY() + i * pinDistance + (pinDistance - textExtent.y) / 2, true);
- }
- gc.setFont(oldFont);