Style listener

The Style listener gives you the ability to track changes in a certain component style object. For example, you might want to monitor changes in the background colour of a component, and react accordingly.

The following code shows how to add a listener and track any style property change to the Font.

myComponent.getStyle().addStyleListener(new StyleListener() {
    public void styleChanged(String propertyName, Style source) {
        if (propertyName.equals(Style.FONT)) {
            System.out.println("Font of myComponent got changed.");
        }
    }
});