How to chang the row's color in the Jtable?

I have a table and many rows,I want chang the rows color,like row one's color is red,row tow's color is write,row three's color is green.How can do it? And if i want chang row 3,coloum 2's color.How can do it?
thanks.

hi,
I use jdbtable to view data,I want them to chang row color when some cells equal the value.But interface getTableCellRendererComponent not run.I don't know why!
jdbtable is extend jtable ,it made in borland jbuilder.
//1 class
package errorreport;
import java.awt.Component;
import java.awt.Color;
import javax.swing.table.DefaultTableCellRenderer;
import com.borland.dbswing.*;
public class rowcolor extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent
(JdbTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column)
Component cell = super.getTableCellRendererComponent
(table, value, isSelected, hasFocus, row, column);
int iColcount = 0;
iColcount = table.getColumnCount();
if( value instanceof String )
String strAlmlev = (String)value;
if(strAlmlev.trim().equals("C1"))
cell.setBackground( Color.red );
// You can also customize the Font and Foreground this way
// cell.setForeground();
// cell.setFont();
else
if(strAlmlev.trim().equals("C2"))
cell.setBackground( Color.orange );
else
if(strAlmlev.trim().equals("C3"))
cell.setBackground( Color.yellow );
else
if(strAlmlev.trim().equals("ERR"))
cell.setBackground( Color.green );
return cell;
//2 class
JdbTable jdbTable2 = new JdbTable();
TableCellRenderer renderer = new rowcolor();
try
jdbTable2.setDefaultRenderer( Class.forName( "java.lang.String" ), renderer );
catch( ClassNotFoundException ex )
System.exit( 0 );
thanks

Similar Messages

  • How to change the default color of the selected row

    hi all,
    I need to know how to change the default color(yellow) of the selected row in a table component.whether i need to change anything in the stylesheet.If so, where should i make the changes in the stylesheet.
    thanks and regards,
    rpk

    The chart colors are being referred to *'palette.cxml'* file in these directories
    BI_HOME\web\app\res\s_oracle10\chartsupport
    BI_HOME\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10\chartsupport
    you can change to your custom colors.
    Restart OC4J and PS to make the new ones work..
    Regards,
    Raghu

  • How to change the background color of a single row

    Hi OTN,
    I am using JDeveloper 11.1.1.2 with ADF faces in view layer.My issue is How to change the background color of a single row in af:table ?.

    How to highlight ADF table row based on column value?
    Found by searching

  • 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 change the default hint box color?

    How to change the default hint box color on the default Metal LookAF?
    I'm trying looking for something with javax.swing.UIManager, but i just find ways to translate the UI.
    Any idea?

    [UIManager Defaults|http://www.camick.com/java/blog.html?name=uimanager-defaults] shows all the properties of the UIManager.
    Although there is no "hint box" component, so I don't know if it will help.

  • How to change the color of Menu links in obiee

    Does anyone knows how to change the colors of Menu links in obiee. With menu I mean the menu links default right top (Search, homepage, Catalogus, Dashboards, new, Open). This should be set in skin and style files, not? I searched a lot. I could not find It. It is now Oracle blue, we want to change this.
    obiee 11.1.1.5.
    Thanks

    You have to customize portal banner and portal content CSS files as needed in OBIEE server.
    below links will guide u but will will not tell you exactly but your req can be done by customizing portal content and portal banner CSS files. try to identify the exact code using firebug in mozilla.
    http://www.rittmanmead.com/2009/04/customizing-obiee-dashboard-banners/
    Customization of login page, banner,logo in obiee11g
    Thanks
    Jay.

  • How to change the color of text but only when that text is highlighted

    I am NOT asking how to change the highlight color OR how to change the text color generally, but rather, how to change the text color as it shows onscreen while it is highlighted. Here's where I'm going:
    Text is ordinarily black (assume) such as when the Finder is open or when viewing a list of all emails in an inbox.
    Let's say I change the highlight color systemwide, in prefs > appearance > highlight color, to a custom color ("other") of black (for example).
    In certain programs (mail, billings, iBank, addressbook, even the Finder), when I highlight a line of something, (like when I one-click on an email or a file name just to select it but not open it), the line will highlight in black, but the text of that line will automatically change to white so it can be seen.
    However, when I highlight actual text (click and drag or double click), such as when editing a document in Pages and selecting a word, line, paragraph, editing an email, etc., the highlight is black, and the text remains black also, which means it cannot be seen (black on black).
    So, how do I change it so that when I highlight the actual text the text color changes to white, then when it is de-selected, it goes back to black.
    I'm not afraid to do a little terminal/command line, but only if it’s a little. Hope this gives enough detail.
    Thanks.

    You can use span HTML tag.
    For example, if your label is "Product Name", and you want it to appear in red, you can type this:
    <span style="color:red">Product Name</span>Hope it helps.
    Ravi

  • How to change the background color of a desktop??

    any ideas how to change the background color of a desktop?? Now the default color is blue. I couldn't fine the API in JDesktopPane on doing that..
    JDesktopPane desktop = new JDesktopPane(); //(textArea);

    Try the method setBackground. For me it's work.

  • HoW to ChaNGE the text in the mobile application to be in MulTi-CoLoR text

    _*  Do anyone can tell me how to change the text in the mobile application to be in multi-color text, to make it more interesting and increase readability?
    Is it using the Graphic's paint() method? or any better suggestion?
    Please give the short example if can?
    Please help... "_"
    Hearing from u all soon...@_@
    thanks....

    Go into outline view. If you can see the outlines of the letterforms, you can't just change the text. If the letterforms are solid black, take the type tool, select the text and type yours.
    Anyway you can just select the letters, take the type tool and type new text.
    Working with the type tool is a basic. Please see the manual for details

  • How to change the color of SAP screen?

    Hi Frens,
    I know it has nothing to do with SD Community, but still I am asking. Can anyone tell me "How to change the color of SAP screen?" It is needed especially when you are working on System Landscape including PRD, Qua & Dev. There are chances that you end up making a test case in PRD instead of Dev or Qua. To avoid that, different color of SAP screen may be very useful and safe.
    Regards
    Vikas Chhabra
    SD/CIN Consultant

    We had a clone of SAP for testing
    Only GUIXT solution was available for users to distinguish between real Prod & Clone as SID was same
    Created 2 scripts n C:\guixt\scripts
    saplsmtr_navigation.e0100.txt
    Esession.txt
    BOTH having identical code
    if V[_ashost=10.3.3.18]
      TitlePrefix "CLONE18"
      TitleSuffix "(CLONE8)"
    endif
    if V[_ashost=10.3.3.25]
      TitlePrefix "PROD25"
      TitleSuffix "(PROD25)"
    endif
    After much research - this was only solution.
    GUIXT will be around; like SAPSCRIPT & SMARTFORMS
    despite the enticement of Adobe Forms!
    After some time you may set GUIXT profile start window HIDDEN
    This you do by clicking profile button of GUIXT menu
    If you want to see GUIXT Window again
    CMD.exe Dos prompt
    cd C:\Program Files\SAP\FrontEnd\SAPgui
    guixt visible
    Regards
    Jayanta Narayan Choudhuri
    Kolkata
    URL: http://ojnc.byethost11.com

  • Hi, I'm working on a document in PAges 09. Any idea on how to change the document color? I want it black instead of white.

    Hi, I'm working on a document in PAges 09. Any idea on how to change the document color? I want it black instead of white.

    Nichelle,
    You must add your own background object, and then make it Black.
    Insert > Shape > Rectangle
    In the Wrap Inspector, set to Floating.
    In the Graphic Inspector, set Stroke to None and set Fill to Black.
    Grab the corners of the document and stretch the document to cover the entire page.
    Back in the Wrap Inspector select "In Background".
    Format > Advanced > Move Object to Section Master.
    Regards,
    Jerry

  • How to change the color background in Pages for iPad?

    how to change the color background in Pages for iPad?

    You can find many themes at https://github.com/hdoria/xcode-themes  There's a download zip button on the right side of the page.
    Unzip and and copy the .dvtcolortheme files into /Users/YourUsername/Library/Developer/XCode/UserData/FontAndColorThemes Create the directory if it doesn't exist.
    If you can't find the Library directory you can get to it by using Finder's "Go to Folder..." option under "Go" or press shift + cmd + G then type the path.

  • How to change the Hyper links color in the XML form

    HI SDNs
    Do u have any idea how to change the hyperlink color in the xml form. My requirement is as follows.I have created xml form by using xml template and i displayed this xml form by using Km document iview.  I need tochange the hyper link color in the xml form content. I dont want to go for manual process by editing the xml form. because i have several hundreds of xml forms.
    Appreciate if you give suggestion.
    Thanks
    Ramana

    Hi Ramana,
    The most convenient way to change the hyper links is by using the Theme Editor. Go to System Administration --> Portal Display --> Select Theme --> Component-Specific Styles --> Links --> Function/Result Link.
    Hope this helps.
    Kind regards,
    Joost

  • How to change the caret/selection color of text input controls?

    Hello JavaFX Community,
    i'm new to JavaFX. I'm using it since i saw the huge steps forward with version 2.0.
    I have the task to migrate a software from Swing to JavaFX. As a part of our corporate design, we used a special color for the caret and text selection. I couldn't find any information about changing the caret color in JavaFX 2, so i'd like to ask you and i'd be very thankful for an advise.
    There is a cross-post at StackOverflow:
    http://stackoverflow.com/questions/10057989/how-to-change-the-caret-color-in-javafx-2-0
    Thanks and best regards.

    This might be possible, but it is not trivial. You cannot do it with a standard API at this time, you will have to look into creating a skin that allows for these properties to be controlled.
    For example, the color of the caret is currently controlled in the TextFieldSkin (look for the "caretPath" property). Just forcing a color change in a subclassed skin is not so hard. Something like this:
    public class MyTextFieldSkin extends TextFieldSkin {
      public MyTextFieldSkin() {
        this.caretPath.fillProperty().unbind();
        this.caretPath.fillProperty().set(Color.RED);
    }However, it gets trickier if this color must be dynamic and if you want other things to be changed as well. It is a place to start though.
    Many of the skins methods and properties are 'protected' though, so atleast in Skin subclasses you have a lot of options to introduce new features and behaviour.

  • How to change the color of SOLIDS ?

    Hi there,
    In the Effects panel, I select the color solids, we only have green and a few colors. I chose the green one as the background.
    Then I wanna choose my own color by changing the color of the green but my eyes are blind, I cannot find where the selection are ?
    Can anyone be kind enuf to let me know where the switch is ? How to change the color of the solids to be used as background ?
    Thanks
    Chers

    Luis Sequeira1 wrote:
    Drag your generator to the timeline. Select int. Look at the Inspector, in the top right corner (if the inspector is not open, you can use Cmd-4 to open it). At the top of the inspector, you have three buttons: "Generator", "Video", and "Info". Click on "Generator" and you get a drop down menu allowing you to choose one of six colors.
    If none of these six serves you well, you can then click on "Video", and use the Color tools to set it to anything you want.
    Thanks Luis for your detailed explanation ... it worked !

  • How to change the display of a spectrogra​m (backgroun​d color)

    how to change the display of a spectrogram (background color).
    I am using JFTA Adaptive spectrogram.  Need to change the color of the background.

    : how to change the display of a spectrogram (background color)
    Attachments:
    snap.docx ‏23 KB

Maybe you are looking for

  • I have mid 2011 macbook air with 10.7.5 and i can't upgrade to 10.9.1.

    When i click download the purchased section always flashes and refreshes itself and it's not downloading the software. But in launchpad there is a mavericks icon which is says downloading but it's not counting the download rate.

  • How can i save my music and pictures on the apple tv?

    i have just got an apple tv and have got my libraries up from my pc but as soon as i close itunes on my pc it stops/disappears from the tv. am i doing something wrong? or have i missed a step? also i have a playlist on my iphone but its not showing i

  • CP2102 USB to UART Bridge Controller installation not working

    I have been working with Silicon Labs and Davis Instruments to try to get this driver installed on my iMac without any success. The driver was working on 10.4.11, but after I upgraded to 10.6.2 it is no longer recognized and does not show up in /dev,

  • Is there a quicker way to do a back-up of a full Lightroom catalogue & DNGs?

    Hoping someone can help - sorry if I'm being thick, I'm not very techno-minded! I am working with Lightroom 3 on a Mac OS X 10.5.8. I archive photos from the Mac hard drive onto an external hard drive (linked to the Mac via an AirPort) every few mont

  • How To update Acrobat 9 STD?

    I just got a new laptop, and have removed Acrobat 9 Standard Edition from my old laptop and installed it in the new one, as version 9.0.0. The built-in updater (help==>check for updates...) will not update the product. (It shows message "There are no