public void setText(String text) { if (textLabel == null) { textLabel = new JLabel(); textLabel.setHorizontalAlignment(SwingConstants.CENTER); } textLabel.setText(text); if (textPanel == null) { textPanel = new FPanel(new BorderLayout()); textPanel.add(textLabel, BorderLayout.CENTER); } else { textPanel.add(textLabel); } this.text = text; }
public void setIcon(Icon icon) { if (iconLabel == null) { iconLabel = new JLabel(); iconLabel.setHorizontalAlignment(SwingConstants.CENTER); } iconLabel.setIcon(icon); // this.initX=6; // this.initY=6; // this.xPad=6; // this.yPad=6; if (iconPanel == null) { iconPanel = new FPanel(new BorderLayout()); iconPanel.add(iconLabel, BorderLayout.CENTER); } else { iconPanel.add(iconLabel); } this.icon = icon; }