Class Label

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class Label extends Component implements Accessible
Emulator for Label — AWT 1.0 static text, not JLabel, rendered by an SLabel peer:
Label total = new Label("Total", Label.RIGHT);
panel.add(total, BorderLayout.NORTH);   // fills the region; text right-aligned
total.setText("Total: 42");

The JDK class is text plus a three-value alignment and nothing else — no listeners at all. Everything a migrator touches beyond the members below (setBounds, setFont, setForeground, setVisible, addMouseListener, …) is inherited Component.

text and alignment are the JDK's fields, and the getters answer from them on any thread without reaching the peer — so getText() returns null verbatim where the peer's Vaadin-backed read would say "". Leaf peer is locked down per R_leaf_peer_lockdown: no protected (Component peer) ctor, so every instance — including a user-code subclass — peers over an SLabel.

The alignment constants are java.awt.Label's own (0/1/2) and collide numerically with SwingConstants' LEFT/CENTER/RIGHT (2/0/4) — a value borrowed from the Swing set means something else here, or throws.

See Also: