Class SLabel
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.Span
com.vaadin.swingbridge.surrogates.SLabel
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.html.Span>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, ComponentMixin, Serializable
Surrogate for
Label — AWT 1.0 static text, not
JLabel. The whole JDK class is text plus a
three-value alignment; no listeners, no icon, no mnemonic, no
labelFor.
SLabel l = new SLabel("Total", SLabel.RIGHT);
l.setText("Total: 42");
l.setAlignment(SLabel.CENTER); // → CSS text-align, read back losslessly
Hosts on Span — SJLabel's <label> exists for
its labelFor wiring, which this class has none of. Rationale for
that, for standing apart from SJLabel, and for mapping alignment
onto text-align rather than SJLabel's flex shape: SD_sbutton's
sibling entry SD_slabel.
Nothing is stored: text lives in the element's text
content, so setText(null) reads back "" (R_vaadin_first
loss — the emulator vaadinx.awt.Label shadows the field
so its getter returns null verbatim per R_swing_is_truth); alignment
lives in the CSS. No setter fires a PropertyChangeEvent, since
AWT's don't — SJLabel does only because JLabel does.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpace -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintprotected StringAWT'sLabel.paramStringtail: the alignment keyword and the text.voidsetAlignment(int alignment) voidMethods inherited from class com.vaadin.flow.component.HtmlComponent
getTitle, setTitleMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttachedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods inherited from interface ComponentMixin
_installSwingClass, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, dispatchEvent, doLayout, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getComponentListeners, getCursor, getFocusListeners, getFont, getForeground, getGraphics, getHierarchyBoundsListeners, getHierarchyListeners, getKeyListeners, getLocation, getMaximumSize, getMinimumSize, getMouseListeners, getName, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolTipText, getX, getY, grabFocus, hasFocus, invalidate, isDisplayable, isFocusable, isFocusOwner, isShowing, paint, paintAll, print, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, revalidate, setBackground, setBounds, setBounds, setCursor, setEnabled, setFocusable, setFont, setForeground, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setToolTipText, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validateMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasComponents
addMethods inherited from interface com.vaadin.flow.component.HasComponentsOfType
add, add, addComponentAsFirst, addComponentAtIndex, bindChildren, getChildren, getComponentAt, getComponentCount, indexOf, remove, remove, removeAll, replaceMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabledMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasText
bindText, getText, getWhiteSpace, setWhiteSpace
-
Field Details
-
LEFT
public static final int LEFTjava.awt.Label.LEFT— 0, which is notSwingConstants.LEFT.- See Also:
-
CENTER
public static final int CENTERjava.awt.Label.CENTER— 1, which is notSwingConstants.CENTER.- See Also:
-
RIGHT
public static final int RIGHTjava.awt.Label.RIGHT— 2, which is notSwingConstants.RIGHT.- See Also:
-
-
Constructor Details
-
SLabel
public SLabel() -
SLabel
-
SLabel
- Parameters:
alignment-LEFT/CENTER/RIGHT- Throws:
IllegalArgumentException- on any other value, as in AWT
-
-
Method Details
-
setText
- Specified by:
setTextin interfacecom.vaadin.flow.component.HasText- Parameters:
text- null renders blank — Vaadin's element text content cannot hold null
-
getAlignment
-
setAlignment
public void setAlignment(int alignment) - Throws:
IllegalArgumentException- on a value outsideLEFT/CENTER/RIGHT, before anything is written, so the label is left untouched (R_match_swing_errors)
-
paramString
AWT'sLabel.paramStringtail: the alignment keyword and the text. -
getAccessibleContext
-