Class DefaultStringColorRowRenderer

    • Field Detail

      • backgroundColor

        protected final Color backgroundColor
        Background Color
      • alternateBackgroundColor

        protected final Color alternateBackgroundColor
        Alternate Background Color
      • foregroundColor

        protected final Color foregroundColor
        Foreground Color
      • alternateForegroundColor

        protected final Color alternateForegroundColor
        Alternate Foreground Color
    • Constructor Detail

      • DefaultStringColorRowRenderer

        public DefaultStringColorRowRenderer()
        Constructor
      • DefaultStringColorRowRenderer

        public DefaultStringColorRowRenderer​(Color backgroundColor,
                                             Color alternateBackgroundColor,
                                             Color foregroundColor,
                                             Color alternateForegroundColor)
        Constructor
        Parameters:
        backgroundColor - Background Color or null for default
        alternateBackgroundColor - Alternate Background Color or null for default
        foregroundColor - Foreground Color or null for default
        alternateForegroundColor - Alternate Foreground Color or null for default
    • Method Detail

      • prepareBackgroundColor

        public void prepareBackgroundColor​(Component comp,
                                           JTable table,
                                           Object value,
                                           boolean isSelected,
                                           boolean hasFocus,
                                           int row,
                                           int column)
        Sets the Background-Color of the component. The rows are getting alternate background-colors. Which color a cell in a row gets is determent by the index of the row. If the index is even then the cell will be white if not the cell will have a different color.
        Parameters:
        comp - The Component
        table - The Table
        value - The Value
        isSelected - Is the cell selected
        hasFocus - Has the cell the focus
        row - Index of the row
        column - Index of the Column
      • prepareForegroundColor

        public void prepareForegroundColor​(Component comp,
                                           JTable table,
                                           Object value,
                                           boolean isSelected,
                                           boolean hasFocus,
                                           int row,
                                           int column)
        Sets the Foreground-Color of the component
        Parameters:
        comp - The Component
        table - The Table
        value - The Value
        isSelected - Is the cell selected
        hasFocus - Has the cell the focus
        row - Index of the row
        column - Index of the Column
      • prepareValueText

        public void prepareValueText​(JLabel label,
                                     JTable table,
                                     Object value,
                                     boolean isSelected,
                                     boolean hasFocus,
                                     int row,
                                     int column)
        Sets a text to the JLabel
        Parameters:
        label - The JLabel
        table - The Table
        value - The Value
        isSelected - Is the cell selected
        hasFocus - Has the cell the focus
        row - Index of the row
        column - Index of the Column