swingx
  1. swingx
  2. SWINGX-509

Alternate Rows incompatible with Substance LAF

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 0.9.0
    • Fix Version/s: 0.9.0
    • Component/s: Table
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      509

      Description

      Environment:
      Swingx 2007/05/01, Linux x86 32, JRE 1.6 Sun

      Description:
      By default, the Substance LAF displays JTable with alternate rows and using the
      current theme colors. When using a JXTable (without swingx alternate rows
      highliter), the Substance rows alternate doesn't work (default theme color is
      used for all rows). Using a simple JTable instead of a JXTable works (we can see
      alternating rows).

      Workaround:
      Using JTable instead of JXTable but loosing all JXTable features

        Activity

        Hide
        kleopatra added a comment -

        hmm ... that's probably due to the SwingX renderers - they go to great length to
        reset every visual property of the rendering component which a highlighter might
        have touched. Plus the alternate row background is defined as responsibility of
        the highlighter, so with a LF doing it by default, we have competing dukes

        No easy satisfying way out that I can see, my suggestion would be to go the
        SwingX way: apply an AlternateRowHighlighter with uses the substance theme
        colors. That's not quite the same as what the LF does because limited to the
        rendered area only - looks funny in trees f.i.

        Jeanette

        Show
        kleopatra added a comment - hmm ... that's probably due to the SwingX renderers - they go to great length to reset every visual property of the rendering component which a highlighter might have touched. Plus the alternate row background is defined as responsibility of the highlighter, so with a LF doing it by default, we have competing dukes No easy satisfying way out that I can see, my suggestion would be to go the SwingX way: apply an AlternateRowHighlighter with uses the substance theme colors. That's not quite the same as what the LF does because limited to the rendered area only - looks funny in trees f.i. Jeanette
        Hide
        bflorat added a comment -

        Correct, it works. See my code below:

        ColorScheme colors = SubstanceLookAndFeel
        .getActiveColorScheme();
        if (SubstanceLookAndFeel.getTheme().getKind()
        == ThemeKind.DARK)

        { jtable.addHighlighter(new AlternateRowHighlighter(colors .getMidColor(), colors.getDarkColor(), colors .getForegroundColor())); }

        else

        { jtable.addHighlighter(new AlternateRowHighlighter( Color.WHITE, colors.getUltraLightColor(), colors .getForegroundColor())); }

        Thanks

        Show
        bflorat added a comment - Correct, it works. See my code below: ColorScheme colors = SubstanceLookAndFeel .getActiveColorScheme(); if (SubstanceLookAndFeel.getTheme().getKind() == ThemeKind.DARK) { jtable.addHighlighter(new AlternateRowHighlighter(colors .getMidColor(), colors.getDarkColor(), colors .getForegroundColor())); } else { jtable.addHighlighter(new AlternateRowHighlighter( Color.WHITE, colors.getUltraLightColor(), colors .getForegroundColor())); } Thanks
        Hide
        kleopatra added a comment -

        just had a look at what Substance it doing: it implements the striping hardcoded
        in a lf-specific renderer which replaces the table's default if that default is
        the core renderer class. Even if SwingX renderers were replaced (they are not
        because they reside in another package) the striping would conflict with the
        SwingX way of highlighting, it's incompatible.

        Nevertheless, the overhauled swingx highlighter api, especially the now more
        cleanly implemented ui specific striping color, might help to get substance
        colors automatically: UIColorHighlighter in the HighlighterFactory looks for a
        color loaded into the UIManager by key "UIColorHighlighter.stripingBackground".

        Jeanette

        Show
        kleopatra added a comment - just had a look at what Substance it doing: it implements the striping hardcoded in a lf-specific renderer which replaces the table's default if that default is the core renderer class. Even if SwingX renderers were replaced (they are not because they reside in another package) the striping would conflict with the SwingX way of highlighting, it's incompatible. Nevertheless, the overhauled swingx highlighter api, especially the now more cleanly implemented ui specific striping color, might help to get substance colors automatically: UIColorHighlighter in the HighlighterFactory looks for a color loaded into the UIManager by key "UIColorHighlighter.stripingBackground". Jeanette
        Hide
        kleopatra added a comment -


        related: issue 601

        Show
        kleopatra added a comment - related: issue 601

          People

          • Assignee:
            kleopatra
            Reporter:
            bflorat
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: