public void setText(String s) { if (s == null) { s = ""; } this.fullText = s; // TODO let user choose between eliding the label and splitting into lines? textNode.setText(splitTextIntoLines(s, MAX_LINES, MAX_TEXT_CHARS)); updateBounds(); }
public void setIcon(Icon icon) { if (pImage != null) { pImage.removeAllChildren(); pImage.removeFromParent(); pImage.getImage().flush(); } if ((icon != null) && (icon instanceof ImageIcon)) { iconWidth = icon.getIconWidth(); iconHeight = icon.getIconHeight(); pImage = new PImage(((ImageIcon) icon).getImage()); pImage.setPickable(false); addChild(pImage); updateBounds(); } }