JTable specific row foreground color

I know how to set a foreground color of a TableCell this isn't the problem.
The problem comes when I want to have a specific row no.

    private class SimpleRenderer implements TableCellRenderer {
        JLabel label;
            label = new JLabel();
            label.setOpaque(true);
        public Component getTableCellRendererComponent(JTable table, Object value,
                                                       boolean isSelected, boolean hasFocus,
                                                       int row, int column) {
            label.setText(value != null ? value.toString() : "");
            if (row == 0) {
                label.setBackground(Color.red);
            } else {
                label.setBackground(Color.blue);
            return label;
    }

Similar Messages

  • Coloring of a (specific) row in ALV report-How?

    Hi Experts,
    Am looking to assign a color for a (specific)row in ALV report.......so, pls. let me know How to get it done?
    thanq

    TABLES:LFA1.
    SELECT-OPTIONS:LIFNR FOR LFA1-LIFNR.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    REGIO LIKE LFA1-REGIO,
    SORTL LIKE LFA1-SORTL,
    CFIELD(4) TYPE C,
    END OF ITAB.
    data:col(4).
    data:num value '1'.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE LIFNR
    IN LIFNR.
    LOOP AT ITAB.
    concatenate 'C' num '10' into col .
    ITAB-CFIELD = col.
    num = num + 1.
    if num = '8'.
    num = '1'.
    endif.
    MODIFY ITAB.
    ENDLOOP.
    TYPE-POOLS:SLIS.
    DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    DATA:EVE TYPE SLIS_T_EVENT WITH HEADER LINE.
    LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    LAYOUT-WINDOW_TITLEBAR = 'VENDORS DETAILS SCREEN'.
    LAYOUT-EDIT = 'X'.
    LAYOUT-info_fieldname = 'CFIELD'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = FCAT.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    this is for coloring cols
    REPORT ZBHCOLOR_COLS.
    TABLES:LFA1.
    SELECT-OPTIONS:C_LIFNR FOR LFA1-LIFNR. " FOR GRID ONLY
    PARAMETERS:LIST RADIOBUTTON GROUP ALV DEFAULT 'X',
    GRID RADIOBUTTON GROUP ALV.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    SORTL LIKE LFA1-SORTL,
    REGIO LIKE LFA1-REGIO,
    COL TYPE LVC_T_SCOL,
    END OF ITAB.
    DATA:COLR TYPE LVC_S_SCOL.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB.
    LOOP AT ITAB.
    IF ITAB-LIFNR IN C_LIFNR.
    COLR-FNAME = 'NAME1'.
    COLR-COLOR-COL = '5'.
    COLR-COLOR-INT = '1'.
    COLR-COLOR-INV = '0'.
    COLR-NOKEYCOL = 'X'.
    APPEND COLR TO ITAB-COL.
    COLR-FNAME = 'LIFNR'.
    APPEND COLR TO ITAB-COL.
    MODIFY ITAB.
    ENDIF.
    ENDLOOP.
    TYPE-POOLS:SLIS.
    DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
    LAYOUT-ZEBRA = 'X'.
    layout-coltab_fieldname = 'COL'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = FCAT.
    IF LIST = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    ELSEIF GRID = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    ENDIF.
    Reward points if useful.

  • How to color specific row in a table....

    Hi all,
    I created a table out of an Array[]. The table is successfully filled up by array's elements. Each element is a row.
    I want to be able to color specific row; instead of every row. How do I do that?
    I was looking rendering to color a row or a string; but not successfull.
    Thank you for your time and assistence.

    My favorite way of doing this is to use CSS. You plan on giving the row you want colored an id attribute, then provide a style like this:
    <style type="text/css">
      tr#colorMe td {
        background-color:blue;
    </style>Then, when you want to color the row, you make the HTML output like this:
    <table ...>
      <tr> //normal row
        <td></td><td></td><td></td>
      </tr>
      <tr id="colorMe"> //colored row
        <td></td><td></td><td></td>
      </tr>
      <tr> //normal row
        <td></td><td></td><td></td>
      </tr>
    </table>

  • To color a specific row in a Table UI element

    Hello Experts,
    We have a requirement to highlight (with distinguish color) a specific row of a table UI based on column data.
    Suppose we have a table with 5 column and 10 row, now if the data on 5th column greater than some XYZ value then we need to highlight the specific row with a different color.
    Can anyone please help me to achieve this requirement?
    Thanks & Regards,
    Sambaran Chakraborty

    Hi,
    In your outline, I am missing quite a few prerequisites which I mentioned (not sure if you have implemented them already)
    your sub node, does it have singleton=false, cardinality 1..1 and selection cardinality 1..1?
    The attribute of type TableCellDesign in that sub node, does it have the calculated property to true?
    If you've bound each table column's cellDesign property to this calculated attribute, you just put some code in the generated generated get<SubNode><CalcAttribute> method to set the color
    For instance by just entering the line
    return WDTableCellDesign.CRITICALVALUE_LIGHT
    in that method will render each linked cell to that color
    Not sure what else I can say to explain this, there's not much to code...

  • How to change the color of specific row in ALV tree

    Hi,
    I m using method set_table_for_first_display of a class CL_GUI_ALV_TREE.
    The req is to change the color of specific row. Now can anybody tell me how to change the color of ALV tree. As in ALV tree and in this method 'set_table_for_first_display', there is no parameter IS_Layout.
    Pls suggest...

    hi
    hope this code will help you.
    Reward if help.
    REPORT zsharad_test1.
    TABLES: ekko.
    TYPE-POOLS: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    line_color(4) TYPE c, "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE slis_layout_alv,
    gd_repid LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    PERFORM data_retrieval.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
    I.e. Field type may be required in-order for
    the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-no_zero = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-seltext_m = 'PO Item'.
    fieldcatalog-col_pos = 1.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'STATU'.
    fieldcatalog-seltext_m = 'Status'.
    fieldcatalog-col_pos = 2.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-seltext_m = 'Item change date'.
    fieldcatalog-col_pos = 3.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material Number'.
    fieldcatalog-col_pos = 4.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MENGE'.
    fieldcatalog-seltext_m = 'PO quantity'.
    fieldcatalog-col_pos = 5.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Order Unit'.
    fieldcatalog-col_pos = 6.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'NETPR'.
    fieldcatalog-seltext_m = 'Net Price'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 15.
    fieldcatalog-datatype = 'CURR'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'PEINH'.
    fieldcatalog-seltext_m = 'Price Unit'.
    fieldcatalog-col_pos = 8.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    FORM build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    Set layout field for row attributes(i.e. color)
    gd_layout-info_fieldname = 'LINE_COLOR'.
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
    gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    ENDFORM. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    FORM display_alv_report.
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = gd_repid
    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    i_callback_user_command = 'USER_COMMAND'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    it_special_groups = gd_tabgroup
    IT_EVENTS = GT_XEVENTS
    i_save = 'X'
    is_variant = z_template
    TABLES
    t_outtab = it_ekko
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    DATA: ld_color(1) TYPE c.
    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
    UP TO 10 ROWS
    FROM ekpo
    INTO TABLE it_ekko.
    *Populate field with color attributes
    LOOP AT it_ekko INTO wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
    i.e. wa_ekko-line_color = 'C410'
    ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
    IF ld_color = 8.
    ld_color = 1.
    ENDIF.
    CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
    MODIFY it_ekko FROM wa_ekko.
    ENDLOOP.
    ENDFORM. " DATA_RETRIEVAL

  • How to set JTable row background color

    Hello,
    I have seen JTable with rows having alternate background color (mostly white and light blue). How can i set the same.
    Thanks,
    Deepak

    Well, i am new user to forum and so have no idea if this question has been asked previously "countless" times.Which is why you "search first" and "ask later". How to you expect to find out what valuable information is in the forum without learning how to do a simple search. This goes for any forum on the web you might use, so don't use the "I'm a new user" excuse.

  • How to set color of our specified JTable's row

    i need to set color of our specified JTable's row.so send the coddings of that part.

    i need to set color of our specified JTable's row.so
    send the coddings of that part.I think you misunderstand how this forum works...
    If you have a problem, you post your problem here with example code which demonstrates said problem...
    The people here then attempt to help you if they want to.
    You do not post demands for code examples

  • JTable - row focus color

    I wrote a program which will change the color of each row.
    odd row background color will be white
    even row background color will be gray.
    My doubt is?
    if i move the mouse on the any row, that row should have a different background color (dark of row background)

    I tried with DefaultTableCellRenderer, but it is not
    workingIs this what you want?
    import java.awt.Color;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.TableCellRenderer;
    public class RowColor extends JFrame {
        public RowColor() {
            Object[][] data =
                {"Row 1", "Row 1"},
                {"Row 2", "Row 2"},
                {"Row 3", "Row 3"},
                {"Row 4", "Row 4"}
            Object[] columnNames = {"Column 1","Column 2"};
            JTable table = new JTable(data, columnNames) {
                public TableCellRenderer getCellRenderer(int row, int column){
                    DefaultTableCellRenderer c = (DefaultTableCellRenderer)super.getCellRenderer(row, column);
                    if (row % 2 == 0)
                        c.setBackground(Color.GREEN);
                    else
                        c.setBackground(Color.YELLOW);
                    return c;
            JScrollPane scrollPane = new JScrollPane( table );
            getContentPane().add( scrollPane );
        public static void main(String[] args) {
            RowColor frame = new RowColor();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    }

  • Change JTable's row color on row selection

    Hello!
    Everywhere I've looked they're only explaining how to draw rows in different colors WHEN THE TABLE IS BEING CREATED, via prepareRenderer.
    But that is not what I am looking for. What I want is to actually change the row's color after the table has been drawn/rendered/whatsoever. For instance, when the user clicks on that row. The default behaviour is for the row to become blueish, but, when the user selects another row, the first selected row turns back to white. I would like to prevent that from happening. I want the row to become FIRE RED when the user clicks on it, and I want the row to remain like that for good, even when the user selects a different row. Do I make any sense here? :-)
    Thank you for your time and future suggestions.

    Everywhere I've lookedApparently you didn't look in the Swing forum, because thats where Swing related questions should be posted.
    but how do I assign a cell renderer to an entire row/table ?The easiest way is to use the prepareRenderer(...) method you have already found. My "TablePrepareRenderer" class (which you can find by searching the Swing forum) shows you how to do this.
    You will note that the color of the row is determined by data in the table. So all you need to do is add another column in the TableModel that contains the information you need to determine the row color. That column can be removed from view in the table by removing the TableColumn from the TableColumnModel.

  • How to change color of a JTable's row

    Hi,
    I have written this code to change the color of the first column and 3rd row of my JTalble but although column painting is OK, row background color applies for all cells. What is wrong with my code?
         public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex)
              Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
              if (vColIndex == 0 && !isCellSelected(rowIndex, vColIndex))
                   c.setBackground(new Color(204, 204, 255));
              if (rowIndex == 3 && vColIndex != 0 && !isCellSelected(rowIndex, vColIndex))
                   c.setBackground(new Color(217, 236, 197));
              return c;
         }     

    You should first set the default background color in your prepareRenderer method (before the if's).
    Message was edited by:
    Andre_Uhres

  • How to colour specific rows within an WebDynpro ALV

    Hi everyone,
    I need to colour only specific rows of an ALV. I've already scoured sdn and implemented the solutions that I found but none of them seems to be working okay.
    I have an ALV table and I want to highlight only a few rows based on a certain logic.
    I've defined a context node that defines 2 attributes: textview_design and cell_design.
      LOOP AT ft_out_purchase_order_temp INTO ls_out_purchase_order_temp.
      if ....
        ls_out_purchase_order_temp-textview_design =  cl_wd_text_view=>e_design-standard.
        ls_out_purchase_order_temp-cell_design = cl_wd_table_column=>e_cell_design-standard.
      else.
          ls_out_purchase_order_temp-cell_design =  cl_wd_table_column=>e_cell_design-total.
          ls_out_purchase_order_temp-textview_design =  cl_wd_text_view=>e_design-emphasized.
      endif.
    ENDLOOP.
      lr_column_settings ?= po_alv_config_table.
      lr_column = lr_column_settings->get_column( 'EBELN' ).
      lr_column = po_alv_config_table->if_salv_wd_column_settings~get_column( 'EBELN' ).
      lr_column->set_cell_design_fieldname( value = 'CELL_DESIGN' ).
    This code works but the thing is that the whole column named 'EBELN' is coloured light green. This is strange because I've instructed the system that the design of the column EBELN is controlled by the field CELL_DESIGN and this field has the following values:
    10    (light green)
    33    (light blue)
    10
    10
    10
    33
    10
    33
    Any ideas?

    Hii,
       To color a particular row you need to follow two things.
    1. Specify condition based on which the row will be colored i.e. set the value for the attribute 'CELL_DESIGN'.
    2. Get all column references and  set the cell design field name with 'CELL_DESIGN'.
    Get all column reference.
    DATA : LT_COLUMNS TYPE SALV_WD_T_COLUMN_REF,
                 LS_COLUMNS TYPE SALV_WD_S_COLUMN_REF.
      LT_COLUMNS = LR_COLUMN_SETTINGS-&gt;GET_COLUMNS( ).
    configure column
      LR_COLUMN_SETTINGS ?= LV_VALUE.                              " column functions
      LT_COLUMNS = LR_COLUMN_SETTINGS-&gt;GET_COLUMNS( ).
    set cell design for all.
    In your case if a single column is getting colored the then the reason might be
    1.every record satisfying your if condition specified.
    2.you have set cell design in that particular field name.
    Regards,
    Monishankar C

  • Is there a way to disallow web pages to modify foreground color of elements if background of those elements was not changed as well (and vice versa)?

    I have very sensible defaults for my display; i.e. I have dark GTK scheme (dark gray background, light gray text) that suits me way more when working on my computer while it's dark around. I, however, like looking at web pages as how they were mean to be seen. Unfortunately, most of web designers don't think about anyone having non-default colors set up.
    Example one ( http://www.cedok.cz ):
    This site's CSS style has "color: rgb(45, 45, 45);" for the whole <body> but for <select> elements there is no "background-color" set. This means there is a select box rendered with dark gray background and dark gray foreground (text color). This is pretty badly readable (obviously).
    To mention one particular element from this site: e.g. <select id="ctl00_ContentPlaceHolderLevySloupec_HledaniMultiTab1_HledaniZajezdu1_ddlTypZajezdu">
    Example two ( https://support.mozilla.org/en-US/questions/new/desktop/customize/form ):
    On this page (where I'm currently filling in this question) the <textarea id="id_content"> has "background: ... rgb(255, 255, 255);" set, but with my default font color, this textarea is rendered as light gray text on a white background. Again, pretty unreadable (and eye-hurting).
    I can provide screenshots and more reasoning if needed.
    I'm asking if there is (or might be) an option (even disabled by default) or at least an add-on which would keep default colors unless both foreground and background colors were specified. I think this might make Firefox very usable for many people which like to have their default colors configured.
    In case you won't be able to help me by fixing this, could you redirect me to the right place where I could get this requested in a way that might be really possible to happen (bugzilla?).
    Thank you very much in advance.

    Thanks for the reply, but I'm sorry, no. I don't want any addon that customizes colors, I want to use default colors and only prohibit changing them unless both background and foreground colors are changed.
    I have made no color changes WRT to Firefox *only*, I just changed the default for the whole toolkit (gtk in this case). The thing I need is to disable changing *only one* property out of two ({back,fore}ground). Whenever the second one gets set as well, this new setting (both of them) may get reflected, but not before that. It'd be nice to keep this when changing the colors back (deleting the style), but that's not necessary.
    I hope that's understandable, feel free to ask for if that's not the case.
    To express what I mean a bit more precisely, see the attached image. In that image there are four textareas (one of the elements that gets affected by this). First one is a default one (which I want to have if the page has nothing set), the second one is nicely modified to fit for example to a blue-ish page (this one I like as well).
    Second row of textareas shows how the final element looks like if the page has only one of these elements set up. First one changes background without changing font color, the second one vice versa. Both of them are very badly readable, especially with low lighting around.
    This is consequently the same case when it comes to default page background which I cannot set at all, because too many pages have only "color:" set without changed background and that is completely messed up then. Going to extremes, I might mention all color-related modifications (see how ugly the borders look when the background is changed and nothing is done to these borders, their size and color is kept default), but I understand that's too much.

  • Foreground color of a disabled component

    How do i change foreground/text color of a disabled component? Something similar to JTextComponent's setDisabledTextColor().

    I'm not exactly sure but I think this is highly component dependent and even look & feel dependent. Sometimes, there isn't even a such color defined anywhere. The component's ui just takes the current foreground color and calls brighter on it.
    You'll have to be more specific on the component you wish to modify.

  • Cant change color on visited sites without changing background /foreground colors that hide options on the sitec

    I want to change the color of visited sites, but am forced to set background and foreground colors which don't properly
    show all of the colors for controls etc on many websites.
    I have to uncheck the button to Allow pages to choose their own colors....
    Google is a good example after doing a search, then change visited sites color, uncheck the allow pages button and then you can't see the search button and most of the options in the top right corner in google.
    I am a little color blind, so can't differentiate blue and purple for links on visited sites...
    thx

    I think the problem is that many sites use background colors to create buttons, so you lose that when you override the page's colors.
    Maybe you could use an add-on to fine-tune colors instead of Firefox's all-or-nothing setting. I found a couple extensions that say they can change page colors, but I haven't tried them myself:
    * [https://addons.mozilla.org/firefox/addon/color-that-site/ Color That Site!]
    * [https://addons.mozilla.org/firefox/addon/colorific-1/ Colorific]
    * [https://addons.mozilla.org/firefox/addon/toggledocumentcolors-198916/ ToggleDocumentColors_]
    * [https://addons.mozilla.org/firefox/addon/color-toggle/ Color toggle]
    For a truly custom approach to link colors, there are two general purpose ways to apply your own style rules to specific sites: the Stylish extension and a userContent.css files. You would need to set a preferred text ''and'' background color for visited and unvisited links so that you are guaranteed to be able to read the text.
    Hope one of these fits the bill!

  • Highlight specific rows in tableview

    I realize that my use of the word highlight is somewhat ambiguous, in the docs its seems to be synonymous with selected. My question is: can you choose to set a background color, or somehow otherwise mimic highlighting for specific rows in a TableView? My example would be file and folder Labels in the finder. They allow a color to be displayed behind a row in the table.

    You can consider 2 options. You can change your node selection property to  0..n , and loop through the node and set the selected property to true based on your logic.
    You can also bind cell editor  design property to context attribute  and bind this attribute to columns cell editor design. You can find wiki about coloring table column.

Maybe you are looking for