コード例 #1
0
 void setPosition(int newX, int newY) {
   Insets insets = eNode.getContext().getInsets();
   FontMetrics metrics = getFontMetrics(getFont());
   int stringWidth = metrics.stringWidth(getText());
   int stringHeight = metrics.getHeight();
   setBounds(
       newX + insets.left + eNode.getWidth() + SEPARATION,
       newY + insets.top + eNode.getInsets().top,
       metrics.stringWidth(getText()),
       metrics.getHeight());
 }
コード例 #2
0
 void setPosition(int newX, int newY) {
   Insets insets = getContext().getInsets();
   insets = getContext().getInsets();
   FontMetrics metrics = getFontMetrics(getFont());
   int stringWidth = metrics.stringWidth(getText());
   int stringHeight = metrics.getHeight();
   setBounds(
       newX + insets.left,
       newY + insets.top,
       stringWidth + getInsets().left + getInsets().right,
       stringHeight + insets.top + insets.bottom + VERTICAL_PAD);
   if (rightLabel != null) rightLabel.setPosition(newX, newY);
 }