swingx
  1. swingx
  2. SWINGX-1451

Add common interface for base methods on SwingX Components

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      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)
      {
         ((JXButton)comp).setBackgroundPainter(p);
      }
      else if (comp instanceof JXLabel)
      {
         ((JXLabel)comp).setBackgroundPainter(p);
      }
      else if (comp instanceof JXPanel)
      {
         ((JXPanel)comp).setBackgroundPainter(p);
      }
      else ...
      

      Instead we could do something like this:

      if (comp instanceof HasBackgroundPainter)
      {
         ((HasBackgroundPainter)comp).setBackgroundPainter(p);
      }
      

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            rah003
            Reporter:
            zonski
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: