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

Similar Messages

  • Report Generation broken after deployment - Excel Set Cell Color and Border.vi

    Upon deployment, the Excel Set Cell Color and Border.vi became broken.  After installing LV2010 SP1 to view the VIs in the deployment, I noticed that in the second case structure where the code draws the border using the BorderAround invoke node, there is an extra variant input parameter named 'Parameters'.  Upon right-clicking, an option to 'Relink Invoke Node' appeared and after selecting this, the extra input disappeared and the VI was no longer broken.
    Why does "Relink Invoke Node" appear?  How do I create a deployment with this issue?  Has anybody else experienced this?  Why is the TestStand deployment so buggy?  

    Hi Ching-Hwa,
    I have set up a test deployment here where I am deploying a workspace that contains a sequence file.  This sequence file has a LabVIEW Action Step calling a VI that opens a new Excel file and simply calls the Excel Set Cell Color and Border VI.  After deploying this, both the VI and my test sequence ran on the deployment machine without error.  Therefore, I do have some more questions to more accurately reproduce what you are seeing.
    First, what operating systems are you developing on and deploying to?  Also, what license do you have for TestStand on the machine you are deploying to?  If you have a development version, can you manually take the sequence file and VI to this machine and run it?  I know you now have LabVIEW 2010 SP1 on your development machine, but if you have the development version of TestStand as well, it would be interesting to see if you copy the files over if you still see this behavior.  Are you including the TestStand Engine in the deployment?
    Can you open a blank VI on the deployment machine and add the Excel Set Cell Color and Border VI?  It would also be interesting to see if this is not a product of the deployment, but rather an issue with something on the deployment machine itself.  What version of the Report Generation Toolkit do you have on each machine?  Also, what versions of Excel are you using on the development and deployment machine?  Again, it would be helpful for me to know exactly what versions you have installed on both the development and deployment machines so that I can reproduce this as accurately as possible.
    One last thing to try, too, would be to try deploying the VI by itself just to see if it also has the same behavior.  Do you have the Application Builder in LabVIEW?  If so, could you also try building an executable from the VI, create an installer, and deploy this to the deployment machine?  
    In regards to the "freezing" of code by removing the block diagrams, I do not believe this will be a proper work around in this case.  While this removes the block diagram from actually being deployed along with the VI and restricts users from editing the code on the deployment machine, if something is getting changed in the compiled code upon deployment, this will not stop this from happening.  This option is available more as a memory option to lower the size of the deployment as well as prohibit any users on the development machine from editing the block diagram themselves.    
    Thanks, Ching-Hwa!  I look forward to your response so that I can continue trying to reproduce this issue.  Have a great day! 
    Taylor G.
    Product Support Engineer
    National Instruments
    www.ni.com/support

  • Setting cell color in ALV

    Hi All
    I would be greatful if someone could please help...
    I am still attempting to get cells painted within a WDA ALV grid display.
    I have tried to use the method stated in the WDA sap press book - but this method is for use with TABLE element and I am using a ViewContainerUIElement for my table. There are mentions of wonderful ways to color cells in a list display - but I cannot understand how this can be achieved. I currently have this working appart from the numeric numbers of the design being set into the relavant column cell.
    If anyone could help that would be great...
    Please see: http://picasaweb.google.co.uk/dave.alexander69/Pictures#5244800978549492338
       LOOP AT lt_zdata INTO ls_zdata.
            lv_index = sy-tabix.
    *       set column values
    *       loop at row data and set colour attributes of individual cells
            LOOP AT lt_columns ASSIGNING <fs_column>.
              lr_col_header = <fs_column>-r_column->get_header( ).
              lr_col_header->set_ddic_binding_field( ).
              CREATE OBJECT lr_input_field EXPORTING value_fieldname = <fs_column>-id.
              lr_column = lr_column_settings->get_column( <fs_column>-id ).
    *         for the date columns only...
              IF <fs_column>-id(4) = 'CELL'.
    *           get and set column dates from select option user input
                READ TABLE lt_dates INTO ls_dates INDEX 1.
                IF lt_dates IS INITIAL.
                  lr_col_header->set_text( 'Date' ).
                ELSE.
                  ls_dates-low = ls_dates-low + lv_incr_date.
                  MOVE ls_dates-low+2(2) TO lv_for_col_date+6(2).   "Year
                  MOVE ls_dates-low+4(2) TO lv_for_col_date+3(2).   "Month
                  MOVE ls_dates-low+6(2) TO lv_for_col_date(2).     "Day
                  MOVE lv_for_col_date   TO lv_col_date.
                  lr_col_header->set_text( lv_col_date ).
                  lv_incr_date = lv_incr_date + 7.
                ENDIF.
                LOOP AT lt_orgdata_dates INTO ls_orgdata_dates
                  WHERE crew = ls_zdata-crew
                    AND position = ls_zdata-position
                    AND name = ls_zdata-person
                    AND trip_arr >= ls_dates-low
                    AND trip_dep <= ls_dates-low.
    *             column heading settings
                  lr_field = lr_table->if_salv_wd_field_settings~get_field( <fs_column>-id ).
                  lr_field->if_salv_wd_sort~set_sort_allowed( abap_false ).
    * trying to set cell variants ?@#??!!???
    *              lr_cv = lr_column->set_key( ls_zdata-variance ).
    *              lr_cv->set_editor( lr_input_field ).
    *              lr_cv->set_cell_design( value = '01').
    *              lr_column->add_cell_variant( lr_cv ).
    * current method of seeting the cell colors... (but puts value in cell!)
                  FIELD-SYMBOLS: <fs> TYPE data.
                  lr_column->set_cell_design_fieldname( value = <fs_column>-id ).
                  ASSIGN COMPONENT <fs_column>-id OF STRUCTURE ls_zdata TO <fs>.
                  WRITE: CL_WD_TABLE_COLUMN=>e_cell_design-one TO <fs>.
                  MODIFY lt_zdata FROM ls_zdata. " INDEX lv_index.
                ENDLOOP.
              ENDIF.
    Kind Regards
    Dave Alexander

    Hi check this code to set cell colors for ALV grid.
    Take a context attribute with type WDUI_TABLE_CELL_DESIGN.
    Here i am populating colors based on some condition.Check the loop of the internal table.
    method get_flight_details .
    data:node_flights type ref to if_wd_context_node,
         it_flights type sflight_tab1,
         ls_flights type sflight,
         it_final type   if_componentcontroller=>elements_flights,
         ls_final type   if_componentcontroller=>element_flights.
        select * from sflight into table it_flights
    up to 100 rows.
        node_flights = wd_context->get_child_node( 'FLIGHTS' ).
        loop at it_flights into ls_flights.
           move-corresponding ls_flights to ls_final.
           if ls_final-price = '185.00'.
              ls_final-readonly = abap_true.
              ls_final-celldesign =
    cl_wd_table_column=>e_cell_design-badvalue_light.
           else.
              ls_final-readonly = ' '.
              ls_final-celldesign =
    cl_wd_table_column=>e_cell_design-goodvalue_light.
           endif.
           append ls_final to it_final.
        endloop.
        node_flights->bind_table(
            new_items            = it_final
            set_initial_elements = abap_true
    *        INDEX                = INDEX
    data: l_ref_cmp_usage type ref to if_wd_component_usage.
    l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
    if l_ref_cmp_usage->has_active_component( ) is initial.
       l_ref_cmp_usage->create_component( ).
    endif.
    data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
    l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
       data:
         l_value type ref to cl_salv_wd_config_table.
       l_value = l_ref_interfacecontroller->get_model(
    * Make Price column editable
    data:l_column type ref to cl_salv_wd_column,
          l_column1 type ref to cl_salv_wd_column,
          lr_input type ref to cl_salv_wd_uie_input_field,
          l_input1 type ref to cl_salv_wd_uie_input_field.
    l_column = l_value->if_salv_wd_column_settings~get_column( 'PRICE' ).
    create object lr_input
      exporting
        value_fieldname = 'PRICE'
    l_column->set_cell_editor( value = lr_input ).
    * to make some cells non editable
    lr_input->set_read_only_fieldname( value = 'READONLY' ).
    l_value->if_salv_wd_column_settings~delete_column( id = 'READONLY'   )
    *Set the table Editable
    l_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).
    *Give colors to cells
    l_column1 = l_value->if_salv_wd_column_settings~get_column( 'CARRID' ).
    l_column1->set_cell_design_fieldname( value = 'CELLDESIGN'  ).
    l_value->if_salv_wd_column_settings~delete_column( id = 'CELLDESIGN' )
    endmethod.
    Thanks
    Suman

  • Excel Set Cell Color and Border.viのbackground color 設定について

    お世話になっております。
    Microsoft オフィス用レポート生成ツールキットを使って
    LabVIEWで収集したデータをExcelファイルで出力しようと考えています。
    そこで質問が有ります。
    題名のようにExcel Set Cell Color and Border.viのbackground color 設定についてです。
    デフォルト(未配線)では白に設定されていますが、”色なし”に設定するにはどうしたら良いのでしょうか?
    又、罫線色等を指定する数値設定に関しては、何処を調べたら良いのでしょうか?
    ご教授の程、宜しくお願い致します。

    _YN 様
    平素よりNI製品をご利用頂きまして誠にありがとうございます。
    日本ナショナルインスツルメンツ技術部の湧川と申します。
    ご質問にお答え致します。
    色なしにしたいとの事ですが、こちらでExcel Set Cell Color and Border.viを使用して簡単なVIを実行させてみましたが色なしに設定することはできませんでした。
    そこで質問したいのですが色なしにする理由というのはバックグラウンドが白のままだとセルの枠が見えなくなるからでしょうか。
    もしそうであれば設定により枠をつけることができますのでそちらの方を試して頂けたらと思います。
    方法としましては同じExcel Set Cell Color and Border.viを使い設定します。
    アイコンの上部にピンク色のピンが2つあるかと思いますがそちらからセル内側の線、外側の線を設定できます。
    添付した画像を参照して下さい。
    画像のように設定しますとセルに黒色の枠ができると思います。
    数値設定などに関しても質問されていますが、そちらはヘルプがありますのでそちらを参照頂けると詳しい情報がわかるかと思います。
    LabVIEWでVIを開いている時に ctrl + H を押しますと小さいウィンドウ「詳細ヘルプ」が立ち上がります、その状態でマウスのポインタをアイコンに重ねて頂きますと詳細ヘルプにアイコンの説明が記述されます。
    ウィンドウズ内のリンクからオンラインヘルプを参照することもできます。
    上記内容をご確認いただきまして、何かS_YN様の意図と違う点などありましたらご連絡下さい。
    宜しくお願い致します。
    日本ナショナルインスツルメンツ株式会社
    技術部
    湧川 朝満
    添付:
    Excle Set Color Sample.JPG ‏58 KB

  • NI_Excel.Ivclass:Excel Set Cell Color and Border.vi Error

    Hi
    I was trying to compile a file and I kept getting an error. It zeroed in on the vi that was not compiling. I am attaching the vi to this message. The vi seems to be broken. And I am not sure how to fix this. Can some one please help me out with this. Thanks in advance. 
    I guess it is associated with Report Generation Toolkit. Please let me know if you need any more details.
    This is the error message 'One or more required inputs to this function are not wired or are wired incorrectly. Show the Context Help window to see what the connections to this function should be.'
    Regards
    Mr Miagi
    Solved!
    Go to Solution.
    Attachments:
    Excel Set Cell Color and Border.vi ‏20 KB

    http://forums.ni.com/t5/LabVIEW/Set-excel-cell-color-and-border-broken-can-t-build-application/m-p/1...
    Please do a search.

  • Excel Set Cell Color and Border VI

    您好,
    請問如果不小心更改到Excel Set Cell Color and Border VI的內容,應如何復原?
    謝謝!!!
    已解決!
    轉到解決方案。
    附件:
    Excel Set Cell Color and Border.jpg ‏231 KB

    http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/zht/pg/1/sn/catnav:du/q/report%20genera...
    以下載點除了 labview 2012 report generation toolkit 以外
    其他都是 patch 檔
    如果您有購買正式版,也許您可以跟 NI 客服部求救

  • How to set item values without using fields in branch's ACTION block?

    Okay, I will try to say this in a easy way so it is not weird.
    I have created a button, SAVE, that has a Branch of branch type: Branch To Function Returning A Page. This is my code for the branch:
    if :P2008_NAP_SUPPORTING_MATERIALS = 'Yes' then
    return '2092';
    else
    return '2040';
    end if;
    The code for this type of branch is stored in the ACTION block of the Branch page. The ACTION block for a Branch of branch type: Branch To Function Returning A Page is different than the ACTION block for a Branch of branch type: Branch To Page Or URL.
    I need to set some item values with some specific values, which I can do with a branch type: Branch To Page Or URL. This is not possible with the branch type: Branch To Function Returning A Page. The ACTION block is totally different.
    How can I set some values on say Page 2040 from Page 2008 without using fields in the branch's ACTION block?
    Thank you in advance,
    Maggie

    Andy and Scott,
    I love seeing different perspectives in solving problems, it opens my eyes to new ways of looking at/using the tools (reserved words and 'Function returning a Page', etc.).
    One of my pet peeves has been that on branches I was limited to only 10 variables to be passed (I know, who would want more - but there was an instance where I had to pass more), and an even more frustrating time when using report Column Linking, which limits me to 3 variables.
    At least with the Branch linking I can use your suggestion Andy and add the variable setting statements into the function. I am assuming of course (and I should be able to) that I will be able to set more that 10 variables in a IF condition prior to the RETURN statement. This method will be much more understandable, for me, when looking through the branch at a later time to see what is happening, than an URL link where all the variable are strung out 'in a line' so to speak.
    I will still need to use URL Target branching on Links contained within a Column Attribute when I need to pass more than 3 variables, of which I have several places where I do this.
    Thomas

  • How to print a plot with two colors Without using two plots

    Hello everybody,
    Escuse my English (poor Frenchies....)
    I'm working with VB6 and I will need to print a plot with two colors (Some values greater than a trigger for example, ...)
    I was looking for some help to discover if that thing is possible without using another plot, this is what I'm already doing, and it do not satisfy me (and my boss....)..
    Thank for your Help.
    Julien

    Hi Julien,
    I have found on the different link to make that you want.
    This first link is on National Instrument site, the first is general, and second provided information about : How Can I Programmatically Print Out a ComponentWorks Graph Object?.
    http://digital.ni.com/public.nsf/websearch/81D87CB2A5BF6C11862569E4008240FE?OpenDocument
    http://digital.ni.com/public.nsf/websearch/dc3430165bc916c586256317006f8cc9
    Links below are on the web, and explain how do you can print a graph on Visual Basic. (the first is French link  )
    http://khany.developpez.com/tutoriel/mschart/
    http://www.programmersheaven.com/zone1/cat378/18546.htm
    Regards,
    Message Edité par Christophe S. le 12-27-2005 01:51 PM
    Christophe S.
    FSE East of France І Certified LabVIEW Associate Developer І National Instruments France

  • Setting body directly without using multipart classes

    I want to be able to send mail using JavaMail by just setting the header and body. I do not want to care about multi-part and the like.
    As an example, whatever be the main content-type, I set that in the header, and set the whole body as a string.
    Example, for the following, I want to just set "multipart/alternative" and set the following as text, and it should handle it.
    ------_=_NextPart_001_01C63EA7.9A5D7BC9
    Content-Type: text/plain;
    charset="us-ascii"
    Content-Transfer-Encoding: quoted-printable
    =20
    ------_=_NextPart_001_01C63EA7.9A5D7BC9
    Content-Type: text/html;
    charset="us-ascii"
    Content-Transfer-Encoding: quoted-printable
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=3DContent-Type content=3D"text/html; =
    charset=3Dus-ascii">
    <META content=3D"MSHTML 6.00.3790.2577" name=3DGENERATOR></HEAD>
    <BODY>
    <DIV> </DIV></BODY></HTML>
    ------_=_NextPart_001_01C63EA7.9A5D7BC9--
    Is there a way to do it?

    Are you trying to make it difficult on purpose? :-)
    I suspect you could use a ByteArrayDataSource with the appropriate
    content type and content data and then set that as the content for the
    message itself:
    msg.setDataHandler(new ByteArrayDataSource(myText, myMIMEtype));

  • Setting PDF color background using Automator

    Has anyone figured out how to add background color to PDF files using Automator? I need an easy, reliable way to establish a specific color background for an evolving series of PDF files (text and images) that are eventually to go online.
    alan

    So close.
    Thanks All
    https://decibel.ni.com/content/blogs/DailyCLAD

  • Batch replace color without using swatch as source

    I've searched these forums and the rest of the web trying to find a method to do this... Actions don't cut it (if Actions were able to record the "replace color" dialoge it would be fine) so I've turned to scripts, but I have almost no knowlege on this.
    I checked out this thread:
    http://forums.adobe.com/message/2588737
    and it is very close, except that it assumes that there is a named swatch as the source color - which there isn't.
    The script I tried was .JS
    I'm trying to have the script run on a bunch of .eps files in a folder:
    - Select object which has specified CMYK value (0,7,34,10)
    - Replace fill color of the selected object with another CMYK value (5,19,36,0)
    - Save over the existing .eps
    - Close
    - Make coffee (optional)
    Also, any books you can recommend for learning this stuff? For a noob.

    Muppet Mark wrote:
    How simple are you documents as a piece of illustrator artwork. Having a better idea of their contents lets us know how deep the script would need to dig to find the colors you wish to exchange? Just path items? used in text? used to color up placed artwork?
    Hey Muppet Mark,
    If you have other script for all possible objects with also stroke or not, it should be useless (i beggining this script, your point of view should be interresting , personnaly i'm blocked on GraphItems and other complex Items)
    Regards, art.chrome
    #target Illustrator
    var doc=app.activeDocument;
    var couleur= new Array()
    ///////////////// Function ////////////////////////
    var couleurCMYKColor = function (myColour){
         var Couleurs= new Array();
         Couleurs[0]=myColour.fillColor.cyan;
         Couleurs[1]=myColour.fillColor.magenta;
         Couleurs[2]=myColour.fillColor.yellow;
         Couleurs[3]=myColour.fillColor.black;
         alert("CMYK\n"+Couleurs);
    return Couleurs;     
    var couleurRGBColor = function (myColour){
         var Couleurs= new Array();
         Couleurs[0]=myColour.fillColor.red;
         Couleurs[1]=myColour.fillColor.green;
         Couleurs[2]=myColour.fillColor.blue;
         alert("RGB\n"+Couleurs);
    return Couleurs;     
    var couleurGrayColor = function (myColour){
         var Couleurs= new Array();
         Couleurs[0]=myColour.fillColor.gray;
         alert("Gray\n"+Couleurs);
    return Couleurs;     
    var kindColor = function (mekind){
    var kind=mekind.fillColor.toString();
         switch (kind){
               case "[CMYKColor]":
               var result=couleurCMYKColor (mekind);
               break;
               case "[GrayColor]":
               var result=couleurGrayColor (mekind);
               break;
               case "[RGBColor]":
               var result=couleurGrayColor (mekind);
               break;
               default:
               alert("This type of Color ("+kind+") wasn't implemented...");
               break;
    var type = function (me){
         with (me){
          switch(typename){
               case "CompoundPathItem":
               // do nothing useless
               break;
               case "GraphItem":
               // ARGGG !! blocked
               break;
               case "GroupItem":
               // do nothing useless
               break;
               case "LegacyTextItem":
               break;
               case "MeshItem":
               break;
               case "NonNativeItem":
               break;
               case "PathItem":
               var mekind=me;
                   kindColor(mekind);
               //alert (result);
               break;
               case "PlacedItem":
               // do nothing
               break;
               case "PluginItem":
               // procced as a group ?
               break;
               case "RasterItem":
               // do nothing
               break;
               case "SymbolItem":
               // complex.. i don't know
               break;
               case "TextFrame":
               var mekind=me.textRanges[0];
               kindColor(mekind);// the first characters
               break;
               default:
               alert("not implemented...");
               break;
    //////////////// End Function /////////////////////////
    for (c=doc.pageItems.length-1;c>-1;c--){
           var sel=doc.pageItems[c];
          if (sel.selected){
         alert(c+": "+sel.typename);
          type(sel);
          //alert(doc.selection[c].typename);

  • Setting threshhold value without using grid

    Hi
    if I create manual database how to set threshold value?
    is there any other tool to set threshold value?

    935025 wrote:
    Hi
    if I create manual database how to set threshold value?
    is there any other tool to set threshold value?what threshold value?
    post URL where it is documented.

  • Is it possible to display unrelated info without using a subreport?

    Hi,
    I'm trying to create a report that displays 2 different sets of information without using a subreport. 
    The first section of info (the part I'm having trouble with) is simple displaying the info in the db.  It is just the differnt security settings of the system.
    The second section of info is each users info and their personal security settings.  This part is not a problem and displays correctly.
    How can I get the first section to be displayed at the top of the report without it affecting the second section which uses the group header and details portion of the report?  When I try and put it in the Page header it throws off the second section and causes the information in the details to be repeated multiple times.
    Is it possible to do this without a subreport?  I'm using Crystal Reports 2008.
    Thanks Mike
    Edited by: Mike Swift on Aug 21, 2008 5:35 PM

    Mike
    Have you tried selecting the "Select Distinct Records" box in report options.
    Maybe this has nothing to do with your problem but I thought I would throw that out.
    Good luck

  • Setting Font Color and Bold Property in ALV Grid

    I have a requirement to set the font in particular ALV Cells  in red color.
    Also this font (text) has to be set to Bold.
    I know how to set cell coloring in ALV Grid, but have no idea regarding how to set font color.
    Could please give me an idea/code segment/suggestion.
    Thank You!

    Please refer this post
    Coloring of ROWS in ALV tree

  • 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.

Maybe you are looking for