Issue Details (XML | Word | Printable)

Key: SWINGX-1451
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: rah003
Reporter: zonski
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.

Add common interface for base methods on SwingX Components

Created: 25/May/11 06:47 PM   Updated: 25/May/11 06:47 PM
Component/s: JXHeader, JXLabel, Misc Component
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Participants: rah003 and zonski

 Description  « Hide

It would be nice if there was a common interface (or set of interfaces) for methods that are common to multiple SwingX components.

For example, the background painter and paint border insets method are common to most SwingX Components (it would be great if they were common to all). Also the foreground painter, and highlighter methods are common to a few components.

This could be in the form of a 'Has' interface, e.g. 'HasBackgroundPainter' or 'HasForegroundPainter', or it could be an aggregate interface (or set of interfaces) such as 'JXComponent' or 'JXTextComponent' with the common methods bundled into logical groups.

This would be useful to avoid stuff like the following (which occurs when you try to share a common background painter across multiple components in a general way - possibly not that common, but it's come up for me):

if (comp instanceof JXButton)
else if (comp instanceof JXLabel)
else if (comp instanceof JXPanel)
else ...

Instead we could do something like this:

if (comp instanceof HasBackgroundPainter)

There are no comments yet on this issue.