Interface FlatStyleableComponent

All Known Implementing Classes:
FlatButton, FlatCheckBox, FlatCheckBoxMenuItem, FlatComboBox, FlatEditorPane, FlatFormattedTextField, FlatInternalFrame, FlatLabel, FlatList, FlatMenu, FlatMenuBar, FlatMenuItem, FlatPasswordField, FlatPopupMenu, FlatPopupMenuSeparator, FlatProgressBar, FlatRadioButton, FlatRadioButtonMenuItem, FlatScrollBar, FlatScrollPane, FlatSeparator, FlatSlider, FlatSpinner, FlatSplitPane, FlatTabbedPane, FlatTable, FlatTableHeader, FlatTextArea, FlatTextField, FlatTextPane, FlatToggleButton, FlatToolBar, FlatToolBarSeparator, FlatTree

public interface FlatStyleableComponent
Interface for all styleable FlatLaf components.

If you already have custom subclasses of Swing components, you can add this interface to your components to add styling getter and setter methods to them.

Since:
2
  • Method Details

    • getStyle

      default String getStyle()
      Returns the style of a component as String in CSS syntax ("key1: value1; key2: value2; ...") or null if no style has been assigned.
      See Also:
      • FlatClientProperties.STYLE
    • setStyle

      default void setStyle(String style)
      Specifies the style of a component as String in CSS syntax ("key1: value1; key2: value2; ...").

      The keys are the same as used in UI defaults, but without component type prefix. E.g. for UI default Slider.thumbSize use key thumbSize.

      The syntax of the CSS values is the same as used in FlatLaf properties files (https://www.formdev.com/flatlaf/properties-files/), but some features are not supported (e.g. variables).

      See Also:
      • FlatClientProperties.STYLE
    • getStyleMap

      default Map<String,Object> getStyleMap()
      Returns the style of a component as Map<String, Object> or null if no style has been assigned.
      See Also:
      • FlatClientProperties.STYLE
    • setStyleMap

      default void setStyleMap(Map<String,Object> styleMap)
      Specifies the style of a component as Map<String, Object> with binary values.

      The keys are the same as used in UI defaults, but without component type prefix. E.g. for UI default Slider.thumbSize use key thumbSize.

      The values are not parsed from a string. They must be binary.

      See Also:
      • FlatClientProperties.STYLE
    • getStyleClass

      default String getStyleClass()
      Returns the style class(es) of a component (separated by space characters) or null if no style class has been assigned.
      See Also:
      • FlatClientProperties.STYLE_CLASS
    • setStyleClass

      default void setStyleClass(String styleClass)
      Specifies the style class(es) of a component (separated by space characters).
      See Also:
      • FlatClientProperties.STYLE_CLASS
    • getClientProperty

      Object getClientProperty(Object key)
    • putClientProperty

      void putClientProperty(Object key, Object value)