Changing cell colors of Webapplication

Dear all,
I want to create a report that does highlights specific cells with colors and/or bold letters.
The example is:
I have a keyfigure consumption and a characteristic consumption_type.
The consumtion_type defines where the consumption occures e.g. facility, block etc.
Now I want to highlight the consumption value with different colors for the consumption_type e.g. facility=red, block=blue
The consumption value should be hightlighted and not the type. It would be perfect if the type would not even be shown.
How can I achive this?
Thanks,
Andreas

Hello Vineet,
Thank you for your reply.
That helped me to get an idea of what is possible there.
I found the following link:
http://help.sap.com/saphelp_nw04/helpdata/en/96/42393c3eb3036be10000000a11402f/frameset.htm
So you saying its possible also to remove cells (e.g. consumption_type) which is only needed to indentify the colors but should not be seen in the report?
I also read in SAP note 931395 that with BW 7.0 it should be possible to manipulate the reports with java (the same that is done now with Abap). Do you have any information about this?
Thanks,
Andreas
Message was edited by:
        Andreas Schuth

Similar Messages

  • Change cell color of query results,font size,style

    Change cell color of query results,font size,style
    Hello
    I have this code below and I want to know if it is possible
    to make the column header a font style different
    Example:
    Font size =12
    Verdena
    blue
    And the cell of the column name a different color for ex
    Yellow
    Can this be done here and where in this code do I put it??
    Thank you so much
    <cfquery name="gelov datasource="kl90">
    SELECT
    FROM
    WHERE
    ORDER BY
    <cfswitch expression="#Form.orderBy#">
    <cfks value="KSNUMBER">
    KS.KS_NBR
    </cfks>
    <cfks value="CREATIONDATE">
    KS.KREATDAT
    </cfks>
    </cfswitch>
    </cfquery>
    <!---html report--->
    <cfswitch expression="#Form.outputFormat#">
    <cfks value="HTML">
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Ctwye Kss Report</title>
    </head>
    <style type="text/css">
    table{
    font-family:Arial, Helvetica, sans-serif;
    font-size:10px;
    td{
    font-family:Arial, Helvetica, sans-serif;
    font-size:10px;
    th{
    font-family:Arial, Helvetica, sans-serif;
    font-size:10px;
    h2{
    font-family:Arial, Helvetica, sans-serif;
    font-size:12px;
    h3{
    font-family:Arial, Helvetica, sans-serif;
    font-size:13px;
    </style>
    <body>
    <cfoutput>
    <table border="0" cellpadding="3" cellspacing="0">
    <tr>
    <td align="center">
    <h3>Ctwye Kss
    Report</h3><br><br></td>
    </tr>
    <tr>
    <td align="center">
    </h2>report returned #getCtwyeKss.RecordCount#
    records</h2></td>
    </tr>
    <tr>
    <td>
    <table border="1" cellpadding="2" cellspacing="0">
    <tr>
    <td width="160">Ks Number</td>
    <td>K-date</td>
    <!--- <td class="dataField">Address</td>
    <td class="dataField">Type</td>
    <td class="dataField">Description</td>--->
    </tr>
    <cfloop query="getCtwyeKss">
    <tr bgcolor="<cfif currentrow mod
    2>GHOSTWHITE<cfelse>WHITE</cfif>">
    <td>#KS_NBR#</td>
    <td>#dateformat(KREATDAT,"mm/dd/yyyy")#</td>
    </tr>
    </cfloop>
    </table>
    </td>
    </tr>
    </table>
    </BODY>
    </HTML>
    </cfoutput>
    </cfks>
    <cfks value="CSV">
    <CFHEADER NAME="Content-Disposition" VALUE="attachment;
    filename=ctwye.csv">
    <cfcontent type="application/msexcel">"Ks
    Number","K-date"
    <cfoutput
    query="getCtwyeKss">#ltrim(KS_NBR)#,"#dateformat(KREATDAT,"mm/dd/yyyy")#"
    <tr #IIF(getCtwyeKss.CurrentRow MOD
    2,DE(''),DE('backgroundColor="##999"'))#>
    <!---<tr bgcolor="<cfif currentrow mod
    2>##808080<cfelse>##ffffff</cfif>"> --->
    </cfoutput>
    </cfks>
    </cfswitch>

    By using <TH> instead of <TD> on your header row
    you can then specify different font type and size in your CSS code.
    th{
    font-family:Arial, Helvetica, sans-serif;
    font-size:12px;
    I'm guessing this is your header?
    <tr>
    <td width="160">Ks Number</td>
    <td>K-date</td>
    <!--- <td class="dataField">Address</td>
    <td class="dataField">Type</td>
    <td class="dataField">Description</td>--->
    </tr>
    If so, change these <TD> to <TH>
    <tr>
    <th width="160">Ks Number</th>
    <th>K-date</th>
    <!--- <th class="dataField">Address</th>
    <th class="dataField">Type</th>
    <th class="dataField">Description</th>--->
    </tr>

  • Mouse over to change cell color

    Can anyone point me to a really good tutorial for doing mouse
    over also
    changes the cell color?.
    Ive tried a few and spent hours on it and just cannot get it
    to work
    correctly.
    Here is my basic starting .css which i start off with each
    time.
    .tnav {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #FFFFFF;
    .tnav a:link {
    color: #FFFFFF;
    font-size: 12px;
    text-decoration: none;
    .tnav a:visited {
    color: #FFFFFF;
    text-decoration: none;
    .tnav a:hover {
    color: #FFFFFF;
    text-decoration: underline;
    .tnav a:active {
    color: #FFFFFF;

    On Thu, 8 Mar 2007 14:42:35 -0000, "Mike"
    <[email protected]> wrote:
    >Can anyone point me to a really good tutorial for doing
    mouse over also
    >changes the cell color?.
    Change your CSS to this:
    .tnav {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #FFFFFF;
    .tnav a {
    color: #FFFFFF;
    display: block;
    text-decoration: none;
    .tnav a:hover {
    color: #FFFFFF;
    text-decoration: underline;
    Add a conditional comment to the <head> of the document
    to correct for
    an IE browser bug:
    <!--[if ie]>
    <style type="text/css">
    .tnav a {
    height: 1%;
    </style>
    <![endif]-->
    Gary

  • Change Cell Color of JTable-Please Help

    Hi All,
    I want to change the color of a Row in a JTable when i click on it. And After that when i click another row i want to retain this color and give another color to the second row.
    If somebody knows how to do this. Do Help
    Thanks in advance
    -Jeena

    Hi,
    thanks for the fast reply
    Using a TableCellRenderer i was able to give colors to the selected row. But when i click another row the color disappears.
    Thanks,
    Jeena

  • Change cell color in jdbTable?

    Hi, I have a jdbTable ... and the result are a result of a query ...
    jdbTable.setDataSet(queryDataSet);
    the rusult are:
    Name - Surname - child - married
    I'd like to change row color when the married is yes and when the child are > 0
    Is it possible to do it? Because I found only JTable example.
    Thank you very much

    Sorry the component name is wdr_test_table  in view SNGL_MARK_CELL see the method wddoinit( ).
    Regards
    Yash

  • Change cell color based on time

    I have a row with 24 cells. I want each cell (from left to right) to change color based on the time. Each cell will represent 1 hour A1=Midnight, B2=1AM, etc... At those specific hours I'd like the corresponding cell to change color. So, at midnight, A1 will change from white to red. I figured I could do this with conditional formatting.
    I created a table with =NOW() and formatted it to display only the hour. I then created my 24 column row and pointed each cell in that row to that =NOW() cell. Each cell now displayed the current hour. I setup conditional formatting so that, for example, if A2=1AM (as displayed in the cell) then the formatting would change, but this didn't seem to work. I'm guessing the conditional formatting is just seeing the formula and not the value in the cell. Any thoughts here?

    There are a couple of issues involved:
    1. Conditional formatting rules compare the value in the cell to be formatted to a fixed value or to the value in another cell. If the rule says "=", then the values must be exactly the same.
    2. Date and Time values in Numbers always contain both a time component and a date component. Always. The cell may be formatted to display only the time, only the date, or both, but no matter what is displayed, the values are equal only if the complete Date and Time value is the same.
    3. "Midnight", "1AM", are text values. They will never be equal to a Date and Time value.
    So the problems are to:
    • Extract the Hour from the Date and Time value returned by NOW()
    • Convert that number to a text value in the form "9AM", "9PM", or optionally "Midnight", and I presume, "Noon"
    • Store that changeable value where it may be compared to the value in the cell to be conditionally formatted.
    • Construct the rule to format the cell(s).
    Row 1 contains a sample of the 24 cells to be formatted.
    Columns D and E, rows 2 to 25 are a LOOKUP table, where the HOUR value is looked up and the corresponding text value returned.
    F2 (highlighted with an orangeish fill) contains the formula which extracts the HOUR value from NOW(), looks it up and returns the value displayed (and to be compared).
    F2: =LOOKUP(HOUR(NOW()),D2:D25,E2:E25)
    Regards,
    Barry
    Edit: Second thought
    The LOOKUP table can be avoided using this formula in F2
    =OFFSET($A$1,0,HOUR(NOW())-15)
    The -15 at the end of the formula works for my sample table, in which column 1 (column A) is 3PM. For column A=Midnight, the shift should be -0 (or just left off).
    Message was edited by: Barry

  • Change cell color if number is different from previous cell

    Hello all and thank you in advance for any help that is provided.
    I want to have the color of text in one cell change if the number entered into that cell is higher than the number entered in the previous cell.
    Example: If cell A=18 and cell B=18 then the font color in both cells is the same.
    If cell A=18 and cell B=20 then the color of the font in cell B should change to another color.
    I have done my best to look through the posted questions to no avail so I apologize if this has already been answered.
    AJ

    Inspector > Format (42)
    Select B2 > Conditional format > Greater than > A2 > Edit > Text > Red, Green whatever. Done.
    As usual the format in B2 can be dragged down by the little o bottom right to B3, B4 etc.
    S.

  • Change cell colors used within a function

    While using various functions in a spreadsheet I use to track my bills on a monthly basis, the functions do a great job of highlighting all the cells included. The problem is.....I cannot see them well, some not at all, since I am color blind and the palette seems to be a very light, pastel. Is there a way to control the colors used by functions to highlight in more basic colors or darker grays?
    Thanks!

    i,
    Have you explored the contrast enhancement options in System Preferences, Personal, Universal Access, Seeing, Display?
    Regards,
    Jerry

  • Change cell color if MAX

    Hello,
    i want to find the max value in my report column and change the background color of it using field expression.
    Thanks in Advance

    You are putting the expression into the fill color of the appropriate textbox? Altering the column name and data set name as appropriate?
    That expression deffinetly does the job in SSRS 05, 08 and 10.

  • Set Cell Color without using DefaultTableCellRenderer

    Hi,
    Is there any possible to set the JTable cell color without using DefaultTableCellRenderer ?. For ex, I have one JTable that having 9 rows and 9 columns. I have to set the cell color in 2nd row & 3rd column.
    Please anyone give me guidance to solve this.
    Thanks & Regards
    S Senthilkumar

    Fine.. Please try to understand my points.
    Because in my application I have JTable that having 10 columns and rows dynamically will come based on the value fetch from arraylist. If I use DefaultTableCellRenderer, for each record its calling CustomTableCellRenderer(). For example arraylist return 10 rows means its looping 100 times(10 rows * 10 columns).
    CustomTableCellRenderrer.java
    ArrayList dataLiveMarket = (ArrayList) new CheckUser().getLiveMarketDetails(unval);
    CustomTableModel modelLiveMarket = new CustomTableModel(dataLiveMarket);
    JTable tableOne = new JTable(modelLiveMarket);
    tableOne.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    CustomTableCellRenderrer.java
    package com.fxtrading.dao;
    import java.awt.Color;
    import java.awt.Component;
    import javax.swing.JTable;
    import javax.swing.SwingConstants;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.TableModel;
    * @author user
    public class CustomTableCellRenderer extends DefaultTableCellRenderer {
        //private TableModel bidLastPrice;
        //int k;
        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus,
                int row, int column) {
            Component component =
                    super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if (column == 0 || column == 1|| column == 2) {
                setHorizontalAlignment(SwingConstants.LEFT);
            } else if(column == 3 || column == 4 || column == 5 || column == 6 || column == 7 || column == 8){
                setHorizontalAlignment(SwingConstants.RIGHT);
            }else if(column == 9){
                setHorizontalAlignment(SwingConstants.CENTER);
            // Change cell Color - Started
            bidLastPrice = table.getModel();
            int bidLastRowCount =(int)table.getRowCount();
            for(k=0; k<bidLastRowCount; k++) {
                String bidPrice = (String)bidLastPrice.getValueAt(k,4);
                String lastPrice = (String)bidLastPrice.getValueAt(k,8);
                bidPrice = bidPrice.replace(",","").replace("$","");
                lastPrice = lastPrice.replace(",","").replace("$","");
                if(Double.parseDouble(bidPrice)<Double.parseDouble(lastPrice)){
                    if(row == k && column == 4){
                        component.setBackground(Color.RED);                   
                    }else{
                        component.setBackground(Color.WHITE);
                    System.out.println("Row Count -->"+k+" Less ----> Bid Price----> "+Double.parseDouble(bidPrice)+" : Last Price----> "+Double.parseDouble(lastPrice));
                }else{
                    if(row == k && column == 4){                  
                        component.setBackground(Color.GREEN);
                    }else{
                        component.setBackground(Color.WHITE);
                    System.out.println("Row Count -->"+k+" More ----> Bid Price----> "+Double.parseDouble(bidPrice)+" : Last Price----> "+Double.parseDouble(lastPrice));
            // Change cell Color - End
            return component;
    }Thanks & Regards,
    S Senthilkumar

  • Changing the color of a Basic line object nested in a table cell

    Can anyone help me out here...I have inserted a line object from the Basic palette into a table cell on my web page and it displays fine but is default black color...I would like to change the color but haven't been successful in doing so..any ideas

    Hmm - doesn't sound right.
    "color=#hex" is not appropriate HTML markup.... Can you show us where you
    made this change?
    Murray

  • HOw can i change the color of a cell

    How can I change the color of a cell when it is selected. I select the cell by pressing enter, then I want the text in the cell to change color to red, but all the cells in the table change color. Please I would be grateful for some help

    Subclass DefaultTableCellRenderer.
    public class MyCellRenderer extends DefaultTableCellRenderer
    Override
    public Componet getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
    JLabel lab = new JLabel(String)value);
    lab.setOpaque(true);
    return lab;
    if(isSelected)
    lab.setBackground(Color.red);
    else
    lab.setBackground(Color.white);
    Set the columns in your table:
    table.getCoulumModel.getColumn(0).setCellRenderer(new myCellRenderer());
    table.getCoulumModel.getColumn(1).setCellRenderer(new myCellRenderer());
    etc. for each column in your table.

  • 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

  • Trying to change the color of a single cell

    hi, I am trying to change the color of a single cell when mouse moves over it, but couldn't do it. i even tried my own renderer, but it doesn't work. can anybody help ?

    Here is what I am trying to do. I am displaying some data in a java JTable retrieved from a table in database. What is needed is when user moves his mouse over any cell in the third column, the cursor should change to hand cursor and possibly the background color should also change, to indicate the user that this cell is clickable. I have to show some other report when user clicks any cell in column three. The code follows as
    import java.awt.*;
    import java.sql.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.sql.rowset.*;
    import javax.swing.table.*;
    public class MouseMotionInTable extends JFrame
    public static void main(String[] args)
      MouseMotionInTable f = new MouseMotionInTable();
      Toolkit tk = Toolkit.getDefaultToolkit();
      Dimension dim = tk.getScreenSize();
      int w = dim.width;
      int h = dim.height;
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setBounds((w-600)/2, (h-300)/2, 600, 300);
      f.setVisible(true);
    MouseMotionInTable()
      Connection con = null;
      CachedRowSet crs = null;
      try
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       con = DriverManager.getConnection("jdbc:odbc:FMS", "", "");
       Statement st = con.createStatement();
       String query = "SELECT ItemName, Alias, ItemReOrderQuty, ItemMeasure FROM ItemInfo";
       ResultSet rs = st.executeQuery(query);
       crs = new com.sun.rowset.CachedRowSetImpl();
       crs.populate(rs);
       st.close();
      catch (SQLException e)
       e.printStackTrace();
      catch (ClassNotFoundException e)
       e.printStackTrace();
      finally
       if(con != null)
        try
         con.close();
        catch (SQLException e)
         e.printStackTrace();
      DBTableModel model = new DBTableModel(crs);
      table = new JTable(model);
      JPanel center = new JPanel();
      center.setLayout(new BorderLayout());
      center.add(new JScrollPane(table), BorderLayout.CENTER);
      add(center, BorderLayout.CENTER);
      table.addMouseMotionListener(new MouseMotionAdapter()
       public void mouseMoved(MouseEvent me)
        int col = table.columnAtPoint(new Point(me.getX(), me.getY()));
        int row = table.rowAtPoint(new Point(me.getX(), me.getY()));
        if(col == 2)
         Object val = table.getValueAt(row, col);
         boolean isSelect = table.isCellSelected(row, col);
         boolean focus = table.isCellSelected(row, col);
         TableCellRenderer cellRender = table.getCellRenderer(row, col);
         Component comp = cellRender.getTableCellRendererComponent(table, val, isSelect, focus, row, col);
         comp.setCursor(new Cursor(Cursor.HAND_CURSOR));
         comp.setBackground(Color.yellow);
    private JTable table;
    class DBTableModel extends AbstractTableModel
    ResultSet rs;
    ResultSetMetaData rsMeta;
    DBTableModel(ResultSet rs)
      try
       this.rs = rs;
       rsMeta = rs.getMetaData();
      catch(SQLException e)
       e.printStackTrace();
    public int getColumnCount()
      try
       return rsMeta.getColumnCount();  
      catch(SQLException e)
       e.printStackTrace();
      return -1;
    public String getColumnName(int c)
      try
       return rsMeta.getColumnName(c+1);
      catch(SQLException e)
       e.printStackTrace();
      return "";
    public int getRowCount()
      try
       rs.last();
       return rs.getRow();
      catch(SQLException e)
       e.printStackTrace();
      return -1;
    public Object getValueAt(int r, int c)
      try
       rs.absolute(r+1);
       return rs.getObject(c+1);
      catch(SQLException e)
       e.printStackTrace();
      return "";
    public boolean isCellEditable(int r, int c)
      return false;
    public Class getColumnClass(int c)
      return getValueAt(0,c).getClass();
    }

  • 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

Maybe you are looking for