Skip to end of metadata
Go to start of metadata

Since the SwingXBuilder subclasses the SwingBuilder, the same operations apply to the SwingXBuilder.

New Features in SwingXBuilder

Shortcutting/Aliasing attribute names

This has actually been around for a while but I only spoke about it to my mentors and not you guys.
Sometimes attribute names are a bit long to type. In this example pulled from one of the unit tests, we can see how to add an alias for any property on a component. During builder parsing, the names are changed to their explicit forms.

Before you ask, I did play around a bit with the idea of aliasing the component names but that was a bit cumbersome.

NOTE: Be careful when aliasing properties, making sure the alias doesn't already exist as a property name. For example, foreground and foregroundPainter exist for some components.

  • No labels