Is it possible to change cell Background color?

I want to change table cell background color.
Can anyone help me with code example?

Hi,
tanusree wrote:
I want to change table cell background color.
Can anyone help me with code example?You can find code example in the java tutorial.
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
exacting
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#renderer
greetings
Axel

Similar Messages

  • Is it possible to change the background color of some options in drop-down

    Is is possible to change the backgound color of certain options in a a drop-down list?
    For example in the list below I would like the background color to be yellow for Jason, John, and Roger:
    Heather
    Jason
    John
    Keith
    Linda
    Roger

    Hi,
    One way is use jQuery.
    Here is sample
    http://apex.oracle.com/pls/otn/f?p=40323:54
    I have this on page HTML header
    <script type="text/javascript">
    $(function(){
    $('#P54_EMP option').each(function(i){
      if(this.value=='KING'||this.value=='SCOTT'){
       $(this).css({'background-color':'yellow'});
    </script>This might help how install jQuery to Apex
    http://www.oracleapplicationexpress.com/tutorials/66
    Or you can just load it from Google by adding this also to page HTML header or page template
    <script src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("jquery", "1.4.2");
    </script>Br,Jari

  • Is it possible to change the background color when publishing as EXE Full Screen?

    I often publish Captivate projects as EXE - FullScreen. I would l like to set the background color outside of the EXE frame. Is that possible. When running my Captivate published .EXEs at full screen at a resolution greater than the project, a tan color background color appears and I would like to change it to black, or some other color. I tried the Skin - HTML background color, but that had no effect.
    Thanks
    Jack
    Captivate 7 / Windows 7

    Hi,
    it is - use the oItem.BackColor property
    BackColor PropertyDescription
    Returns or sets a value specifying the background color of text or graphics in an item.
    Property type
    Read-write property
    Syntax (Visual Basic)
    Public Property BackColor() As Long
    Remarks
    RGB value in long representation. You can use the standard Visual Basic colors, for example, vbBlue, vbYellow, etc.
    The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF).
    lg David

  • Is it possible to change the background color in EVENTS view?

    I know that you can change the color once you enter into an event. But it seems like the main 'events' page only has a charcoal background with no facility to change it. Is this correct? Or is there a way to change it? I'm not a huge fan of black backgrounds, and less a fan of dirty gray backgrounds. Help???

    I hadn't thought of that method! You could make a suggestion to Apple at https://www.apple.com/feedback/iphoto.html
    but it looks like major changes are on the way so it may not be the best time (see the last item - bottom - of http://www.apple.com/osx/preview/apps/ )

  • FORMS 6i and cells background color

    Hello,
    I ve got a tabular forms based on a table.
    Is it possible to change the background color of ONE or MORE cells ?
    Thanks.
    Romeo.

    I am with Mediware Information Systems and we have an opening for a Senior Oracle 6i DBA if you know of anyone who has 5 yrs. of Oracle 6i DBA experience. If so, they can send their resume to [email protected] with the subject line 06-029.
    Thanks!

  • Change the background color of a title bar

    I'd like to know if it's possible to change the background color of a swing application title bar.
    Thanks in advance.

    In Windows I think you can change the overall look of the desktop - Standard Windows comes with a bluish scheme, but you can change that, say to something like greenish. On NT you do it using right click on desktop > Properties > Apperance > Scheme etc etc.
    So I think Frame title colour is very much a OS specified thing.

  • Is it possible to change the background of Web Dynpro Views in MDE apps ?

    Hi Team,
    Is it possible to change the Background color of Web Dynpro Views in Mobile Device applications ?
    I have been able to change the cellBackgroundDesign from Transparent o fill1 etc and this change is visible in the desktop application.
    But whenever; I am running this application in Mobile Device, the color change is not visible.
    Also, there is an earlier post given by me for changing the color of rows in Table UI in SAP SRS Mobile Device Enabled.
    Color code logic not feasible in Pocket Browser
    Our Mobile Devices are:
    http://emobilescan.co.uk/downloads/manuals/ppt8800.pdf
    The OS is: Windows 2003
    and the Browser is: Pocket Browser.
    Please give me in any suggestion which I can implement to see the background color change w.r.t, Mobile Devices.
    Thanks & Regards
    Kaushik Banerjee
    SAP Portal

    Hi,
    Have you uploaded your Photobook to Kodak Gallery or Shutterfly?

  • Can i change the background color to grey?

    I was wondering if it is possible to change the background color
    of JDeveloper to grey so that i can "relieve" my eyes.
    Thanks,
    Alex.
    null

    hi user505516
    You could try "Tools" > "Preferences..." > "Code Editor" > "Syntax Colors" and from the "Available Styles" list select "Default plain text" and from the "Background Color" dropbox select the color you prefer.
    (tip : You can use "Your Control Panel" to make your name visible in forum posts.)
    success
    Jan Vervecken

  • How to change the Background color of a cell in JTable

    hi!
    Actually i want to change the background color of few cells in JTable
    is there any method to make this change in JTable ?
    and also is it possible to have 5 rows with single column and 5 rows with 3 columns in a single JTable

    i want to change the background color of few cells in JTableDepending on your requirements for the coloring of cells it may be easier to override the prepareRenderer() method of JTable:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=610474

  • Right way to change datagrid row, column, cells background colors in code-behind?

    Hi all,
    I have a winform program that I'm upgrading to wpf (I'm new to wpf). The wpf code for the function (SetdataGridBackgroundColors()) is below with the winform code commented out so I can fix it.  I have a datagrid with a Cornsilk background color alteranating
    with LightGreen depending on the content of datetime  cell. If the day portion of the datetime is different then the color changes from one to the other. I used a colorIndex variable because at the end of the month it could go from 31 to 1 and that would
    not work if I use the day directly.
    I tried this line to change the background color:
    optionsDataDatagrid.RowBackground = new SolidColorBrush(Colors.Cornsilk);
    this works but it changes every row. I found this other stuff:
    DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromIndex(i) as DataGridRow;
    //DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromItem(optionsDataDatagrid.Items[i]) as DataGridRow;
    currentRowColor.Background = new SolidColorBrush(Colors.Cornsilk);
    Either ContainerFromIndex or ContainerFromItem throw an exception because currentRowColor is null. I looked at optionsDataDatagrid.Items[i] and is not null. Then I read that using ItemContainerGenerator is not a good idea.
    BTW I'm calling SetdataGridBackgroundColors() after datagrid is been filled with data.
    So... what is the proper way to set each row, column or cell background color in wpf?
    Thanks
    private void SetdataGridBackgroundColors()
    optionRowData rowData = new optionRowData();
    if (optionsDataDatagrid.Items.Count == 0)
    return;
    int colorIndex = 1;
    DateTime savedDate, currentRowDate;
    rowData = optionsDataDatagrid.Items[0] as optionRowData;
    savedDate = rowData.col_datetime.Date; //only compare the date not the time
    for (int i = 0; i < optionsDataDatagrid.Items.Count; i++)
    //currentRowDate = Convert.ToDateTime(optionsDataDatagrid.Rows[i].Cells[3].Value); //winform code
    //currentRowDate = currentRowDate.Date; //winform code
    rowData = optionsDataDatagrid.Items[i] as optionRowData;
    currentRowDate = rowData.col_datetime.Date;
    if (currentRowDate != savedDate)
    colorIndex++;
    savedDate = currentRowDate;
    if (colorIndex % 2 == 0)
    //optionsDataDatagrid.Rows[i].DefaultCellStyle.BackColor = Color.Cornsilk;
    //------------------- testing new code --------------begin
    optionsDataDatagrid.RowBackground = new SolidColorBrush(Colors.Cornsilk); //this changes all rows
    //DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromIndex(i) as DataGridRow;
    //DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromItem(optionsDataDatagrid.Items[i]) as DataGridRow;
    //currentRowColor.Background = new SolidColorBrush(Colors.Cornsilk);
    //------------------- testing new code --------------end
    //optionsDataDatagrid.Columns[4].DefaultCellStyle.BackColor = Color.DarkSalmon;
    //optionsDataDatagrid.Columns[5].DefaultCellStyle.BackColor = Color.Aquamarine;
    //optionsDataDatagrid.Rows[i].Cells[4].Style.ApplyStyle(optionsDataDataGridView.Columns[4].DefaultCellStyle);
    //optionsDataDatagrid.Rows[i].Cells[5].Style.ApplyStyle(optionsDataDataGridView.Columns[5].DefaultCellStyle);
    else
    //optionsDataDatagrid.Rows[i].DefaultCellStyle.BackColor = Color.LightGreen;
    //------------------- testing new code --------------begin
    optionsDataDatagrid.RowBackground = new SolidColorBrush(Colors.LightGreen); //this has no effect
    //------------------- testing new code --------------end
    //optionsDataDatagrid.Columns[4].DefaultCellStyle.BackColor = Color.Coral;
    //optionsDataDatagrid.Columns[5].DefaultCellStyle.BackColor = Color.LimeGreen;
    //optionsDataDatagrid.Rows[i].Cells[4].Style.ApplyStyle(optionsDataDataGridView.Columns[4].DefaultCellStyle);
    //optionsDataDatagrid.Rows[i].Cells[5].Style.ApplyStyle(optionsDataDataGridView.Columns[5].DefaultCellStyle);

    I (also) strongly recommend mvvm.
    Setting values is a particularly bad idea in this case.
    I don't mean to be rude but your explanation of the requirement is kind of vague.
    I would bind solidcolourbrushes.
    Set the properties based on whatever your logic is within the viewmodel.
    You can switch out what each of the brushes holds when the user clicks wherever.
    So you use a highlightbrush when something or other is true.
    That highlightbrush is set to a blue brush when the user clicks left and a red brush when they click right.
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • How to change the background color of a cell based on other cell background

    Hi,
    Sorry if this is a basic question - I am new to XML. I want to create a table column, with no data in it. I then want to change the background color of the column based on the background color of other columns. I.E.
    - If there are 3 or less cells in this row that are not green, color this cell green.
    - If there are 4 or less cells in this row that are not green, and 3 or less are not red, color this cell yellow.
    - If there are 4 or less cells in this row that are not green, and 3 or more are red, color this cell red.
    If there are 5 or more cells in this row that are not green, color this cell red.
    Many thanks for any assistance.

    Okay - I have this resolved.
    1. Create two variables (Yellow and Red):
    <?xdoxslt:set_variable($_XDOCTX, 'Yellow', 0)?>
    <?xdoxslt:set_variable($_XDOCTX, 'Red', 0)
    2. For each cell, set the background based on their individual traffic light criteria, and update the associated color variable by 1. By default the backgrd color is set to Yellow so I only have to check for the lower and upper bounds:
    <?choose:?>
    <?when:number(CHECKED_IN)<=1?>
    <?attribute@incontext:background-color;'Lime'?>
    <?end when?>
    <?when:number(CHECKED_IN)>3?>
    <?attribute@incontext:background-color;'Red'?>
    <?xdoxslt:set_variable($_XDOCTX, 'Red', xdoxslt:get_variable($_XDOCTX, 'Red') +1)?>
    <?end when?>
    <?otherwise?>
    <?xdoxslt:set_variable($_XDOCTX, 'Yellow', xdoxslt:get_variable($_XDOCTX, 'Yellow') +1 )?>
    <?end otherwise?>
    <?end choose
    3. I now want a cell that is Red if any of the cells in the row is red. Its yellow of there are 3 or more yellow cells in the row, and no reds. Otherwise its green. First, create an empty cell and make the default color green. Then add:
    <?if: number(xdoxslt:get_variable($_XDOCTX,'Red')) > 0?>
    <?attribute@incontext:background-color;'Red'?>
    <?end if?>
    <?if: number(xdoxslt:get_variable($_XDOCTX,'Yellow')) >= 3 and number(xdoxslt:get_variable($_XDOCTX,'Red')) = 0?>
    <?attribute@incontext:background-color;'Yellow'?>
    <?end if?>
    4. Finally, reset the variables for the next row:
    <?xdoxslt:set_variable($_XDOCTX, 'Yellow', 0)?>
    <?xdoxslt:set_variable($_XDOCTX, 'Red', 0)

  • How to change the background color of a cell in datagrid using flex3

    i want to change the background color of a cell.....how can i achieve this.....and also i want to know how a spacing cane be done between cells in a datagrid...plzzz help me???

    The only way I can see to do this is to use an item renderer for your cells.  This is really scruffy and would need tyding up, and maybe with a little more time could do better or someone else may have an idea but none the less this works.
    Define a custom component as below;
    This has logic to see what the value of the data is proveided by the dataprovider for the row, and if it matches the conditions in this case is equal to 5 sets the background color.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="88" height="26" dataChange="doColor()" borderColor="#000000" borderStyle="solid"
        backgroundAlpha="1">
        <mx:Script>
            <![CDATA[
                private function doColor():void {
                    if (data.value == 5) {
                        setStyle('backgroundColor', 0xcccccc);
                    } else {
                        setStyle('backgroundColor', 0xffffff);
            ]]>
        </mx:Script>
    </mx:Canvas>
    Now just apply the item renderer in the datagrid and that will do it.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"  xmlns:ns1="*">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                [Bindable]
                private var ac:ArrayCollection = new ArrayCollection([
                    {value : 1},
                    {value : 2},
                    {value : 3},
                    {value : 4},
                    {value : 5},
                    {value : 6},
                    {value : 7},
                    {value : 8},
                    {value : 9},
                    {value : 10}
          ]]>
        </mx:Script>
        <mx:DataGrid x="40" y="36" width="408" height="193" dataProvider="{ac}">
            <mx:columns>
                <mx:DataGridColumn headerText="Column 1" dataField="value" itemRenderer="MyComp"/>
                <mx:DataGridColumn headerText="Column 2" dataField="col2"/>
                <mx:DataGridColumn headerText="Column 3" dataField="col3"/>
            </mx:columns>
        </mx:DataGrid>
    </mx:Application>
    I hope this helps
    Andrew

  • Change the background color of a cell in JTable

    Hi all,
    How can I change the background color of individual cell in JTable. I need to construct my own TableCellRenderer or not? I'm now using the DefaultTableCellRenderer now.
    Thx

    You could create your own renderer or you could try something like:
    table = new JTable(model)
         public TableCellRenderer getCellRenderer(int row, int column)
              DefaultTableCellRenderer tcr =
               (DefaultTableCellRenderer)super.getCellRenderer(row, column);
              if (row == 1 && column == 1)
                   tcr.setBackground(Color.green);
              else
                   tcr.setBackground(Color.red);
              return tcr;
    };

  • Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.? I want to alter the formatting (i.e., text and/or cell background color), but not cell content.

    Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.?
    I want to alter the formatting (i.e., text and/or cell background color), but not the content, of the target cell(s).

    Hi Tom,
    Your LOOKUP formula will return a value that it finds in the "other" table. That value can be used in conditional highlighting rules. (Numbers 3 calls it conditional highlighting, not conditional formatting. Just to keep us awake, I guess, but it works the same).
    Please explain what you are trying to do.
    Regards,
    Ian.

  • How to change a selected cell background color in JTable?

    Hi all,
    I am trying to change the background color of a selected cell by clicking on that particular cell. DefaultTableCellRenderer class provides setBackground(Color c) to change the background color of unselected cells. Is there a way to change a selected cell background color?
    Thank you,
    Arthur

    Write your own renderer (eg. extending DefaultTableRenderer) and put in getTableCellRendererComponent method something like this:
    if( isSelected && hasFocus )
        setBackground( Color.RED );
        setForeground( Color.GREEN );
    }

Maybe you are looking for

  • How do I configure my bluetooth on my iPod Touch 4G to automatically play music when connected and to connect as media not a phone?

    Is there any way to have my iPod Touch automatically start playing music when it connects to my car stereo via Bluetooth? Also, I would like the option to connect to my car stereo as media only and not as a phone. My car stereo supports the ability t

  • How do I hide the menu bar on Safari when watching videos on full screen mode?

    Hey guys, I have a mid 2010 macbook pro (Snow Leopard OS X 10.6.8) which I have recently restored from time machine after installing a new hard drive. However, now when I watch flash videos on putlocker or hulu etc the menu bar on safari on the top l

  • My new 30g black

    I just purchased a new 30 gig black video ipod and im having trouble getting my music from real player to my i tunes can anyone help me with ths problem?? the last thing i want to do is to have to put all my cd's on itunes.... can someone please help

  • BSEG table value can't apply formula

    I download amount column for BSEG into excel, for example, in excel, the document number 400000235 has amount 51.866,60, when I apply formula column X=1.5*amount column, it shows #value!, if I change to 51866.6, it works fine, I have more than 2000 l

  • Not able to Check Delta Enabled Checkbox in Datasource

    Hi, I created a Custom Datasource in ECC system which extracts data through Function module.  I activated the Datasource without checking the Delta checkbox.  Only when i created Infopackage in BI, i realized my mistake.  When i try to go back to ECC