Color the cell

Hello All,
      I have a tableview with contents.
These contents are summated as  totals and sub-totals in a new row within the tableview.
Now, I want to color the cell which is summed i.e
I have 5 records with 10 columns.
at every new 1 st column the totals are done to the column 3.
Now i want to color the summated value of the column 3,
not the whole column.
Is it possible ?
I so can anyone guide me ?
Regards,
Deepu.K

Hi Deepu,
you might have to use the HTML tags to get the required color for the cell.
E.g - when appending amount total into the internal table - first move that amount into a character type and then append it with color tag of the classic HTML
something like this...
"<span style="color:blue;">100.00</span>" - instead of appending just the amount you will need to append the amount along with HTML color tag. This might work for you..
Cheers

Similar Messages

  • Coloring the cell's in workbook using Macros

    Hello Guru's,
    Here I got issue,
    We have Report executed in the Excel, and after that we have to make another sheet(workbook) to calculater all the Before year values , Actual Year values and then the Planned values. We did calculater the varience and Percentage of the varience. All this is ok. i was pretty much able to manage.
    But here the question i am putting in front of you guyus is , we have to cloror the cells of the Percentage column base on the threshold or bias like if
    cell values is >= 0 it should be red
    cell value is  < 0 it should be Green
    cell value is < -0.5 it should be yellow.
    i have been looking around in the forums all day, and i am very new to Macros.
    I did go through Peter Knoer forums.
    Hope i get a good reply from you guys,
    Thank& Regards,
    Kiran

    Thank you Dash,
    you gave me a good idea for me, But here i got one problem,
    i got the code , but i want to do it for 4 colums, for all the 4 colums i am reprting the code , i want to avoid the repetion of the same code, how would i do that.
    i am giving the code for 2 colums below.
    can me plz help on this.
    Sub Sheet1()
        Dim i As Integer
        Dim j As Integer
        Dim k As Integer
        Dim l As Integer
        For i = 10 To 39
            For j = 2 To 2
                If Cells(i, j) >= 0 Then
                    With Cells(i, j).Interior
                    .ColorIndex = 0
                    .Pattern = xlSolid
                    End With
                    Else
                 If Cells(i, j) < 0 And Cells(i, j) >= -0.5 Then
                    With Cells(i, j).Interior
                    .ColorIndex = 6
                    .Pattern = xlSolid
                    End With
                 Else
                    With Cells(i, j).Interior
                    .ColorIndex = 3
                    .Pattern = xlSolid
                    End With
                End If
                End If
            Next j
            Next i
            For k = 10 To 39
             For l = 5 To 5
                If Cells(k, l) >= 0 Then
                    With Cells(k, l).Interior
                    .ColorIndex = 0
                    .Pattern = xlSolid
                    End With
                    Else
                 If Cells(k, l) < 0 And Cells(k, l) >= -0.5 Then
                    With Cells(k, l).Interior
                    .ColorIndex = 6
                    .Pattern = xlSolid
                    End With
                 Else
                    With Cells(k, l).Interior
                    .ColorIndex = 3
                    .Pattern = xlSolid
                    End With
                End If
                End If
            Next l
       Next k
    End Sub
    How to proceed from here.
    Thanks
    Kiran

  • To color selected cells in dynamically created table in ALV.

    Hi,
           The requirement is to display a table (whose columns are dynamic) using ALV n to color few cells of the table based on some condition.
    For creating the table dynamically i have used the method cl_alv_table_create=>create_dynamic_table.
    Now for coloring the cells i tried to use the field EMPHASIZE .
    But when I try this method the whole column is getting colored.
    So any suggestions on how to color only particular cells.

    Hi,
    Try this one...
    DATA: gs_layout TYPE slis_layout_alv, "Define layout
    gt_color TYPE lvc_t_scol WITH HEADER LINE. "Define Internal Table for Cell Colouring
    Use below Sample Code after building a Field Catalog:
    gs_layout-coltab_fieldname = 'COLINFO'.
    " 'it' is the final internal table which contain positive & negative value of Field 'MENGE'
    LOOP AT it.
    REFRESH gt_color.
    CLEAR gt_color.
    IF it-menge GE 0.
    CLEAR gt_color.
    gt_color-fname = 'MENGE'.
    gt_color-color-col = cl_gui_resources=>list_col_positive.
    gt_color-color-int = 0.
    APPEND gt_color.
    ELSEIF it-menge LE 0.
    CLEAR gt_color.
    gt_color-fname = 'MENGE'.
    gt_color-color-col = cl_gui_resources=>list_col_negative.
    gt_color-color-int = 0.
    APPEND gt_color.
    ENDIF.
    it-colinfo[] = gt_color[].
    MODIFY it.
    ENDLOOP.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = g_repid
    is_layout = gs_layout
    it_fieldcat = ct_fieldcat
    i_save = 'A'
    TABLES
    t_outtab = it
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    Hope this solves your problem.
    Regards,
    Tarun

  • Color table cells depending on value of entry in row (UI5 & JSON)

    Hello all,
    I've stuck here a bit. There have been some discussions about how to color the cells of a table that has been bound to a JSON data model. I found some answers how to color individual cells (http://http://scn.sap.com/thread/3383698), but I have a hard time to fulfill the following requirement (rephrased for simplicity):
    Given value "a" in the first cell of a table row, color the row cells 1 - 4 in blue, and 5-7 in red.
    Given value "b" in the first cell of a table row, color the row cells 1 - 4 in yellow and 5-7 in green.
    This wouldn't be a problem with normal HTML as I could easily assign style classes to every cell, however I can't find the solution for the UI5 table.
    Any ideas?
    Thanks,
    Christian

    Hi Nishant,
    not sure if I undestand you correctly.
    When I scroll the table, the data scrolls with the table correctly, but in the "Last Name" column the formatting gets messed up.
    To solve this, you need to remove the previously added classes:
      // Approach 2
        template = new sap.ui.commons.TextView().bindProperty("text", {
                parts: [
                    {path: "***" },
                    {path: "lname" }
                formatter: function(***, lname){
                   // Remove previously added classes
                  this.removeStyleClass("cyan").removeStyleClass("yellow");
                  if(*** == "m" ){
                    <!-- approach 2 step B : Add Css style class to element -->
                    this.addStyleClass("yellow");
                  }  else  if(*** == "f" )
                       this.addStyleClass("cyan");
                  return lname ;
        oTable.addColumn(new sap.ui.table.Column({ label: "Last Name",
                template: template,
    Same for the first approach using where you have to remove the custom data instead if the class.
    This should solve the problem. (By the way this is already mentioned in this thread in my post from Mar 10, 2014 11:40 AM)
    Greeets,
    ben

  • How do i change the cell color of each cell in datagrid dynamically

    I have a  datagrid filled in with data..My job is to change the cell color of a particular cell in the datagrid when the user clicks that cell..Please help me asap..I have to change the color of each cell dynamically..

    Pls find the solution of ur problem.Let me know if you have any issue.
    MainApplicaion.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.events.ListEvent;
                [Bindable]
                  private var listDataArrayCollection:ArrayCollection=
                  new ArrayCollection([
                    {seq:'1',color:'0xFF0000', names:'John'},
                    {seq:'2',color:'0x00FF00', names:'Alex'},
                    {seq:'3',color:'0x0000FF', names:'Peter'},
                    {seq:'4',color:'0xFF0000', names:'Sam'},
                    {seq:'5',color:'0x00FF00', names:'Alis'},
                    {seq:'6',color:'0x0000FF', names:'Robin'},
                    {seq:'7',color:'0xFF0000', names:'Mark'},
                    {seq:'8',color:'0x00FF00', names:'Steave'},
                    {seq:'9',color:'0x0000FF', names:'Fill'},
                    {seq:'10',color:'0xFF0000', names:'Abraham'},
                    {seq:'11',color:'0x00FF00', names:'Hennery'},
                    {seq:'12',color:'0x0000FF', names:'Luis'},
                    {seq:'13',color:'0xFF0000', names:'Herry'},
                    {seq:'14',color:'0x00FF00', names:'Markus'},
                    {seq:'15',color:'0x0000FF', names:'Flip'},
                    {seq:'16',color:'0xFF0000', names:'John_1'},
                    {seq:'17',color:'0x00FF00', names:'Alex_1'},
                    {seq:'18',color:'0x0000FF', names:'Peter_1'},
                    {seq:'19',color:'0xFF0000', names:'Sam_1'},
                    {seq:'20',color:'0x00FF00', names:'Alis_1'},
                    {seq:'21',color:'0x0000FF', names:'Robin_1'},
                    {seq:'22',color:'0xFF0000', names:'Mark_1'},
                    {seq:'23',color:'0x00FF00', names:'Steave_1'},
                    {seq:'24',color:'0x0000FF', names:'Fill_1'},
                    {seq:'25',color:'0xFF0000', names:'Abraham_1'},
                    {seq:'26',color:'0x00FF00', names:'Hennery_1'},
                    {seq:'27',color:'0x0000FF', names:'Luis_1'},
                    {seq:'28',color:'0xFF0000', names:'Herry_1'},
                    {seq:'29',color:'0x00FF00', names:'Markus_1'},
                    {seq:'30',color:'0x0000FF', names:'Flip_2'}
                private function onItemClick(event : ListEvent):void
                    var dataObj : Object = event.itemRenderer.data;
                    dataObj.color = "0xFF00FF";
                    event.itemRenderer.data = dataObj;
            ]]>
        </mx:Script>
        <mx:VBox width="300" height="100%"
            horizontalAlign="center"
            verticalAlign="middle">
            <mx:DataGrid id="listComponent" width="50%"
                     height="100%"
                     borderStyle="none"
                     dataProvider="{listDataArrayCollection}"
                     itemClick="onItemClick(event)">
                     <mx:columns>
                     <mx:DataGridColumn width="100" dataField="{data.seq}" headerText="Seq" itemRenderer="SeqItemRenderer" />
                     <mx:DataGridColumn width="100" dataField="{data.names}" headerText="Name" itemRenderer="NameItemRenderer"/>
                     </mx:columns>
                     </mx:DataGrid>
        </mx:VBox>
    </mx:Application
    NameItemRenderer.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
        width="100" height="30" horizontalGap="5" horizontalScrollPolicy="off">
    <mx:Script>
        <![CDATA[
            override public function set data(value:Object):void
                 super.data = value;
        ]]>
    </mx:Script>
            <mx:TextInput width="75" height="30"
                 text="{data.names}"
                 editable="false" backgroundColor="{data.color}"/>
        </mx:HBox>
    SeqItemRenderer.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
        width="100" height="30" horizontalGap="5" horizontalScrollPolicy="off">
    <mx:Script>
        <![CDATA[
            override public function set data(value:Object):void
                 super.data = value;
        ]]>
    </mx:Script>
            <mx:TextInput width="75" height="30"
                 text="{data.seq}"
                 editable="false" backgroundColor="{data.color}"/>
        </mx:HBox>
    with Regards,
    Shardul Singh Bartwal

  • How to programmatically change the cell color of an ADF table ?

    Hi all,
    I have an ADF table with some fields on it. Depending on the value of a field named, say, "F1", I would like to change its background color.
    So far I can change the field color with this EL expression inside the InlineStyle table column property:
    font-size:medium; background-color:#{viewScope.myBean.setColor};
    where setColor is a bean function, in where I access the field "F1" via binding, parse its value, and return the right value - so far, so good.
    The bad thing is, the InlineStyle affects that field in all the rows of the table, while I would like to change only the field in the rows, which have that specific value in it.
    So for example having the rows:
    F1
    abc#1 ----> currently selected row
    cde#2
    efg#3
    I want to change the background color to all the F1 fields which have a "1" after the '#' and let the other "F1" row cells background color stay unchanged.
    But as you can imagine, the InlineStyle affect the "F1" background color in all the rows (assuming that the first row of the table is selected).
    So the question: how to access a single cell of a row in an ADF table, and programmatically change its background color ?
    So far I can iterate through the ADF table with:
    BindingContext bindingctx = BindingContext.getCurrent();
    BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("aTableIterator");//access the iterator by its ID value in the PageDef file
    RowSetIterator rsi = dciter.getRowSetIterator();
    System.out.println("rsi getrowcount = " rsi.getRowCount());+
    Row row = null;
    +if (rsi.getRowCount() > 0) {+
    row = rsi.getCurrentRow();
    System.out.println("row attr = " Arrays.toString(row.getAttributeNames()));+
    System.out.println("class : " row.getAttribute("F1").getClass().toString());+
    +}+
    +while (rsi.hasNext()) {+
    row = rsi.next();
    System.out.println("row attr = " Arrays.toString(row.getAttributeNames()));+
    +}+
    Regards,
    Sergio.

    Hi,
    I mean a specific cell within a row.
    Here are two pictures that show an ADF table with two rows and some fields on it:
    https://skydrive.live.com/?cid=7D3084D8BF755808&id=7D3084D8BF755808!107&sc=documents#cid=7D3084D8BF755808&id=7D3084D8BF755808!107&sc=documents
    bild_A is what I have, bild_B is what I would like. Note that:
    in bild_A the first row contain a yellow background color for the field F4 and an orange background color for the field F5. This is correct, because F4 has an "1" at the end of its string value, and F5 has a "3" at the end. So far so good.
    But the second row (again, bild_A) has also the fields F4 with yellow background color, and the field F5 with orange background color, even if the value in both fields is 0.
    What is should be, is shown in bild_B.
    The problem is that the solution provided affects all the cells of the column, while I need to change the background color of a single cell, and leave the other unchanged (see bild_B).
    I hope that clarify a bit :)
    Sergio.

  • Change the cell color in JTable?

    Hi all,
    I'm trying to do that, the user make a selection of multiple cells in a table. And when it press enter, I whant to change the color of the selected cells.(the isEditable of JTable it's already overwritten to return always false)
    I have already make my own CellRender, my problem is, because the cell remains unchanged the render are not called...
    Thanks,
    NeuralC

    You need not access this function when you want to paint a cell. This is how your code while instantiating the table should typically look like.
    JTable table = new JTable(model);
    table.setDefaultRenderer(Object.class,new MyCellRenderer());
    and
    public class MyTableCellRenderer extends JLabel implements TableCellRenderer
    public MyTableCellRenderer
    setOpaque(true);
    setBackground(Color.white);
    public Component getTable.....(JTable table,Object value,......) //fill all these things
    setFont(table.getFont());
    if(value != null && isSelected)
    setHorizontalAlignment(SwingConstants.RIGHT);
    setText(value);
    return this;
    When you set MyTableCellRenderer to the table, the getTableCellRedererComponent method is called automatically to renderer the cells and only the selected cells will be hightlighted in blue color. For a better understanding of how tables work and their corresponding Renderers work, you might have to read the tutorial on JTable. Do that as that would help you in removing all the confusion.
    Thanks,
    Kalyan

  • SSRS Reporting : Fill Cell Color according to the Location of the Cell in the Matrix

    Hello,
    I am trying to achieve below result in the SSRS but facing issues with Cell color Fill Expression when Detail value is NULL.
    If you look at the image, it should show exact same colors of the cell irrespective of the values.
    But in my case it is not showing color for NULL value cells.
    Below is the expression which I have put in the Fill Expression window.
    SWITCH(
    Fields!Columns.Value = "Col1" And Fields!Rows.Value = "Row1","Yellow",
    Fields!Columns.Value = "Col1" And Fields!Rows.Value = "Row2","Green",
    Fields!Columns.Value = "Col1" And Fields!Rows.Value = "Row3","Green",
    Fields!Columns.Value = "Col1" And Fields!Rows.Value = "Row4","Green",
    Fields!Columns.Value = "Col2" And Fields!Rows.Value = "Row1","Red",
    Fields!Columns.Value = "Col2" And Fields!Rows.Value = "Row2","Yellow",
    Fields!Columns.Value = "Col2" And Fields!Rows.Value = "Row3","Yellow",
    Fields!Columns.Value = "Col2" And Fields!Rows.Value = "Row4","Green",
    Fields!Columns.Value = "Col3" And Fields!Rows.Value = "Row1","Red",
    Fields!Columns.Value = "Col3" And Fields!Rows.Value = "Row2","Red",
    Fields!Columns.Value = "Col3" And Fields!Rows.Value = "Row3","Yellow",
    Fields!Columns.Value = "Col3" And Fields!Rows.Value = "Row4","Green"
    Please suggest me to get the colors for the NULL value cells.
    I tried with IsNothing() but then it is doing the same color of all NULL cells. I want them exactly same in the figure.
    Thank you,
    Mittal.

    Hi Mittal,
    Based on your dataset table, the matrix should displays as below. Are you manually insert Row1 row and Col3 column in the matrix?
    If that is true, the Fill cell color should be displayed as the picture above. Because there are no values for Rows=Row1 and Columns= Col1, Rows=Row1 and Columns= Col2… the expression for those cells has no effect. To achieve your requirement, we can manually
    insert those values in the dataset query like below:
    SELECT Columns, Rows, Value FROM table
    UNION all
    select 'Col1' AS Columns, 'Row1' AS Rows, NULL AS Value
    UNION all
    select 'Col1' AS Columns, 'Row3' AS Rows, NULL AS Value
    UNION all
    select 'Col2' AS Columns, 'Row1' AS Rows, NULL AS Value
    UNION all
    select 'Col2' AS Columns, 'Row4' AS Rows, NULL AS Value
    UNION all
    select 'Col3' AS Columns, 'Row1' AS Rows, NULL AS Value
    UNION all
    select 'Col3' AS Columns, 'Row2' AS Rows, NULL AS Value
    UNION all
    select 'Col3' AS Columns, 'Row3' AS Rows, NULL AS Value
    UNION all
    select 'Col3' AS Columns, 'Row4' AS Rows, NULL AS Value
    Then directly add those three field with the fill cell color expression to matrix, the matrix displays:
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to set colors in cells depending the conditions  in alvtree

    Hi All,
    Could you please provide me idea or sample program how to set colors in cells depending the conditions  in alvtree.
    Thanks,
    Suresh

    When running vim in a terminal, it will use whatever colour scheme is defined by the terminal.  You should have a look at this thread:
    http://bbs.archlinux.org/viewtopic.php?id=51818
    Also, check the wiki article on Xdefaults.

  • Background color of the cell in EXCEL not working....Pls help..

    Hi gurus,
    I have written a procedure to change the background color of the cell in EXCEL.The code is as below..
    PROCEDURE set_header     (p_row IN NUMBER, p_col IN NUMBER, p_value IN VARCHAR2, p_border IN VARCHAR2 DEFAULT 'N',p_bgcolor IN VARCHAR2 DEFAULT 'N') IS
    BEGIN
         v_args     := ole2.create_arglist;
         ole2.add_arg(v_args, p_row);
         ole2.add_arg(v_args, p_col);
         v_cell     := ole2.get_obj_property(v_worksheet, 'cells', v_args);
         v_font     := ole2.get_obj_property(v_cell, 'font');
         ole2.set_property(v_font, 'fontstyle', 'bold');
         ole2.set_property(v_font, 'size', 9);
         ole2.destroy_arglist(v_args);
         if p_border = 'Y' THEN
              v_border := ole2.get_obj_property(v_cell, 'Borders');
              ole2.set_property(v_border, 'LineStyle', 1);
              ole2.release_obj(v_border);
         End If;
         if p_bgcolor ='Y' THEN
              v_bgcolor := ole2.get_obj_property(v_cell,'Bgcolor'); --This is not woking
              ole2.set_property(v_bgcolor,'bgcolor','red');
              ole2.release_obj(v_bgcolor);
         End If;
              ole2.set_property(v_cell, 'value', p_value);
              ole2.release_obj(v_cell);
         END set_header;
    Pls tell me how to change the backcolor and forecolor in the cell...
    Thanks

    The background color is set for the "Interior" object of the selected cells (Range).
    Try something like this (haven't tested it):
    v_interior := ole2.get_obj_property(v_cell,'Interior');
    ole2.set_property(v_interior,'ColorIndex',3); --should be red
    ole2.release_obj(v_interior);
    If the Foreground color = Font Color then
    ole2.set_property(v_font,'ColorIndex',6); --should be yellow
    Gerald

  • Color the Particular cell

    Hi Techies
    I have one req in which i need to color the Particular cell, Provide me the Logic for that in which only change filed should be highlight to a specific Color.
    I have alogic for color the whole column and Row, but i need to color only particular cell.
    Moderator message: vague, help not possible without asking return questions, what cells are we talking about, provide as much technical detail as possible when posting.
    Edited by: Thomas Zloch on Feb 15, 2012

    Thanks Edward for ur reply...
    But in Inventory In warehouse report they gave the total as in different color.How they done that?????
    Regards,
    Anitha

  • Rules applied to multiple cells trigger color changes when any of the cells

    "Rules applied to multiple cells trigger color changes when any of the cells meet the rule’s condition." That's what Help says, but when I follow the directions, it doesn't work. This is in Numbers 08.
    I have a table where the contents of one column are either "YES" or "NO", depending on formulas using variables from other cells. If YES, I want the fill of that cell and that of two adjacent cells to change from white to green. I select all three cells and use conditional format rules for "text contains:" YES, then choose my fill color. When I return to the table and introduce values for the variables that trigger the rule, only the cell in the YES/NO column changes to green; the other two remain white.
    While I am spreadsheet challenged, I usually can follow directions as plain as those in Help, but it's not working. I couldn't find anything in the discussions after an hour of searching. Is this a known problem or am I just stupid?

    For what it's worth, that's the way I read that line in the User Guide as well. What it actually appears to mean, though is 'Rules applied to multiple cells apply independently to each of the cells."
    Here's a workaround for your three adjacent columns. Long, but fairly simple steps.
    Add a second table to the sheet (Table 2).
    Resize the second table to one column wide and as many rows as you want to apply the conditional format to.
    Set the width of the column to the same width as the three columns you want to highlight, and the row height(s) to match the rows.
    Format to table to have NO Header or Footer row or column.
    Use the Wrap Inspector to uncheck "Object causes wrap"
    In the first top cell of Table 2, enter an = sign, then Click on Table 1 in the sidebar, Click on the first cell that will hold YES or NO.
    Fill the formula down the rest of Table 2.
    With all cells in Table 2 selected, use the Cell Format inspector to set the 'text contains yes' rule and the conditional fill colour for these cells.
    Test the conditional formating by introducing values into Table 1.
    Click on Table 1 in the sidebar, then use the Table inspector to set Cell Fill to 'none'.
    Click on Table 2 in the sidebar, then drag that table onto table 1 aligning it to cover the cells in which the conditional formating is to appear.
    When positioned (and still selected), go to the Arrange menu and Send Backward to move Table 2 behind the (transparent) cells in Table 1.
    With Table 2 still selected, click on the Cell Borders color well and set the Opacity of the borders to 0%.
    Click the Text inspector and set the Text colour Opacity for Table 2 to 0%.
    Regards,
    Barry

  • HELP!! set the cell color in jTable

    I need to set the color of a specific cell in jTable, but, I need to retain the old color in the jTable. It must not reset the whole table.
    would anyone help me in this problem... PLSSSSS its urgent

    A flexible variation on this is to specify formatting options in the JTable's client properties:
    // Use some sort of special "key" to indicate the cell and that you want to set the background color
    String key = "background:" + row + "," + column;
    table.putClientProperty(key, Color.green);You can then write a general table cell renderer that looks for these special formatting options and it doesn't disrupt your existing TableModel in any way:
    public class FormattingTableCellRenderer extends DefaultTableCellRenderer
      public Component getTableCellRendererComponent(JTable table, Object value, int row, int column, ...)
        Component component = super.getTableCellRendererComponent(table, value, row, column, ...);
        // See if the JTable specifies any properties to override the default format
        Color backgroundColor = (Color)table.getClientProperty("background:" + row + "," + column);
        if(backgroundColor != null)
          component.setBackground(backgroundColor);
        return component;
    }Any custom cell renderers you have then simply need to extend FormatTableCellRenderer instead of DefaultTableCellRenderer.
    It's very easy to add formatting options other than background, such as font, to the list of recognised attributes. You'll probably need to make some alterations to get it to recognise selection/focus but hopefully you get the idea.
    Hope this helps.

  • How to change the color of the Cell in Table ?

    Thanks a lot

    Here is the code to change the color of the cell in Table.
    First you need to write a class extending JTextField and implementing TableCellRenderer interface which has only one method as follows
    public class MyCellRenderer extends JTextField implements TableCellRenderer
    public Component getTableCellRendererComponent(JTable table, Object value,boolean isSelected, boolean hasFocus,int row, int column)
    setForeground(Color.blue);
    and wherever you create the table you need to set this renderer as the table cell renderer for your table. code follows...
    TableColumnModel tcm = yourtable.getColumnModel();
              Enumeration tce =tcm.getColumns();
              while (tce.hasMoreElements())
                   TableColumn tc=(TableColumn)tce.nextElement();
                   tc.setCellRenderer(new MyCellRenderer());
    this will solve your problem. you need to import the required packages.
    Srinivas.

  • ALV color priority:  The layout color or the cell color?

    I'm trying to assign an ALV at the cell level but it is not showing up.  I have specificed the column color at the layout level.  Does the layout level have color priority?

    Hi
    see the doc and do accordingly
    1. add one more field to ur final internal table say COLOR(4)
    2. in layout wa_layout-style_fname = 'COLOR'. " if its grid
    wa_layout-style_fieldname = 'COLOR'. "if its list
    3. read table itab index 3.
    itab-color = 'C410'.
    modify itab index 3
    4. see program SHOWCOLO for all color codes
    1. Add a field of data type CHAR(3) to the internal output table.
    2. Enter the color code in the appropriate field of the row to be colored in the internal
    output table:
    Code: 'Cxy'
    C = Color (all codes begin with 'C')
    x = color number ('1' - '9')
    y = highlight ('0' = off, '1' = on)
    3. Assign the internal output table color code field name to the IS_LAYOUT importing
    structure IS_LAYOUT-INFO_FIELDNAME field and pass this structure in the ALV call
    interface.
    To enable row coloring, you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row. So, let’s modify declaration of our list data table “gt_list”.
    you should fill the color code to this field. Its format will be the same as explained before at section C.6.3. But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by passing the name of the field containing color codes to the field “INFO_FNAME” of the layout structure.
    e.g.
    ps_layout-info_fname = <field_name_containing_color_codes>. “e.g. ‘ROWCOLOR’
    You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.
    You can color an entire row as described in the next section. However, this method is less time consuming.
    Coloring Individual Cells
    This is the last point about coloring procedures for the ALV Grid. The procedure is similar to coloring an entire row. However, since an individual cell can be addressed with two parameters we will need something more. What is meant by “more” is a table type structure to be included into the structure of the list data table. It seems strange, because including it will make our list data structure deep. But anyhow ALV Grid control handles this.
    The structure that should be included must be of type “LVC_T_SCOL”. If you want to color the entire row, this inner table should contain only one row with field “fname” is set to space, some color value at field “col”, “0” or “1” at fields “int” (intensified) and “inv” (inverse).
    If you want to color individual cells, then for each cell column, append a line to this inner table which also contains the column name at field “fname”. It is obvious that you can color an entire column by filling this inner table with a row for that column for each row in the list data table.
    Regards
    Anji

Maybe you are looking for

  • Module pool Issue

    Hi I have created  a module pool program , its working fine on development , bbut when transporting in quality server there is coming error in include  SAPMPROGTOP  in line 8  DDIC ztable is not active while ztable is active in Development server , e

  • IPOD Nano won't sync because of missing files!

    When I try to sync my ipod nano an error code pops up saying "Songs on the Ipod nano cannot be updated because all of the playlists selected for syncing no longer exist. How can this be corrected??

  • Zen Xtra: USB Cable length

    Does anyone know what the cable length is? Because just recently, a friend of mine bought me one, and I needed to get a PCI to USB card because my PC only supported USB .. But, I want the cable to reach up to the top of my tower at least. Thanks.

  • How to update cost condition VPRS and Updating from VPRS to new cond ZVPR

    Hi All, How to do and is there any way to update the VPRS cost condition whenever vendor sends confirmation of material and cost after purchase order. After receiving the confirmation form the vendor,the VPRS cost condition should get updated in the

  • Changing foreign exchange rate on posted revenue/reversal  in SAP

    Hi Friends Can you please help me on the following issue We have a Japanese order where we  have booked in Period 4 2011 and reversed revenue in period 6 2011.  The reversed revenue used the period 6 JPY rate to convert to USD. However, the revenue s