URGENT - Change color for a set of rows in JTable

Hello all,
How can i set color for a particular set of row which are all having same values in a cell. If any other rows contains same value that should also be in different color.
Example:
I have 10 rows containing itemcode and taxes in JTable.
1st, 2nd and 4 th row contains same value of Taxes -- It should be in a set of color. red
6th and 8th row containing same value of Taxes -- it should be in a set of color blue
other are in normal color. Kindly send the coding for the above. Advance thanks.
Regards,
N.A. Ramasubramani / Chennai.

Hi,
Here is how I do it... create a Vector of Vector or an array[row][col] containing colors for every cell (row,col). Create a custom Cell renderer in which you pass the color data variable. Then in the renderer you get the Row and Col and set the appropriated color for the background.
JRG

Similar Messages

  • How do you set the font color for a specific entire row inside a JTable?

    How do you set the font color for a specific entire row inside a JTable?
    I want to change the font color for only a couple of rows inside a JTable.
    I've seen some ways to possibly do this with an individual cell.
    Clarification on changing the font color in an individual cell would be helpful too if
    there is no easy way to do this for a row.

    hai,
    Try out with this piece of code.Create your table and assign the renderer to each column in the table.
    CellColorRenderer m_CellColorRenderer = new CellColorRenderer();
    for(int i=0;i<your_JTable.getColumnCount();i++)
    your_JTable.getColumnModel().getColumn(i).setCellRenderer(m_CellColorRenderer);
    class CellColorRenderer extends JLabel implements TableCellRenderer
    CellColorRenderer()     
    setOpaque(true);     
    setHorizontalAlignment(LEFT);
    setVerticalAlignment(CENTER);
    setBackground(Color.white);
    setForeground(Color.black);
    protected void setValue(Object value)
         setText((value == null) ? "" : value.toString());
    public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected, boolean hasFocus, int row,int column)
         if(isSelected == true)
              setForeground(Color.red);
         else
              setForeground(Color.black);
         setValue(value);
         return this;
    regards,
    bala

  • Change color for

    I need to make links from keywords in PDF to files which is stored on harddisk.
    As for now I've done following
    1. Searched PDDoc with WordFinder for keyword
    2. Created link annotations from keyword quads
    3. Make filespecification and set it as launch action for all link annotations
    Now I need to change color for recognized keyword below link annotation. Could anybody help me with any hint?
    Thanks in advance.

    Look at the PDEdit APIs - that's what handles content.

  • S:TextArea How change color for some chars in text?

    I have s:TextArea and i need in runtime change color for some chars displayed in text.
    How i must to do this correctly?

    pcardinale wrote:
    Initially, a control has no caption.  It's not just that the caption string is empty and the caption not visible, but the caption object does not exist.
    I think this should probably be changed in future versions, because even if each control had a caption, it would still be a negligible small part of the VI. The current behavior made sense many years ago where HD and memory space was very precious. Not any more!
    This issue comes up often enough that it warrants addressing the root of the problem.
    It is hard to convince the casual that the caption does not exist if he can simply do a "show caption" at edit time and it will show in all glory, even with the default set to the current label. It is confusing!
    There is even an idea about this that seems worth supporting (also read the link in the discussion).
    What do you think?
    LabVIEW Champion . Do more with less code and in less time .

  • How to get the "last changed by" for a set of function modules?

    How to get the "last changed by" for a set of function modules?
    is there any table to get it??

    See [this|Re: Date of creation of function module] I posted earlier.
    >TFDIR will give you the name of the function group program and the include number.
    >E.g. SAPLZFUNCGROUP Include 01.
    >From this you can construct the include name: LZFUNCGROUPU01.
    >You can look this up in TRDIR to find the creation date (CDAT) of the function module.
    In your case, you need unam and udat.
    matt

  • Is theere an app I can download that will let my LED light change colors for like when it alerts u fora call or message?

    Is there an app I can download that will let my LED light change colors for like when it alerts u for a call or message?

    On the iPhone 4, the LED cannot change color.

  • IOS 7: Will there be updates to change colors for the Notes

    iOS 7: Will there be updates to change colors for the Notes & Text msgs? The white background washes out the text.

    Nobody here has any knowledge of what Apple may or may not include in future updates.
    You can send feedback to Apple about your wishes though - http://www.apple.com/feedback/

  • Can i change colors for events in the calendar?

    Can I change colors for different events in Calendars on Ipad 2?

    Philly - I always respect your opinion and what you have to say but please hear me out.
    Philly_Phan wrote:
    I see one iCal window and that makes me conclude that I have one calendar with multiple event types.
    You understand how the app works and how to create calendars. As I pointed out - I explained to one user that you have to tap the Calendar button in the upper left corner and then select the calendars that you want to view. In fact, if you have accidentally tapped Hide All Calendars - you see no events.
    I totally understand what you are saying and I rarely take an argumentative approach in this forum, but what I am trying to point out to the OP is that you cannot create different colors for "events" in one single calendar.
    For instance, if you have one calendar called "Home" and that is the one calendar that you use - if Billy has a soccer game at 6:00 PM, Jessica has band practice at 7:00 PM and you have a bridge club meeting (I'm stuck for another idea at the moment ) at 7:30 PM - and you want all of these "Events" to appear in different colors within the same calendar - it cannot be done.
    Sometimes I think this is what users want to do - differentiate the different "Events" within a single calendar - and that cannot be done - at least AFAIK.
    I didn't mean to cause confusion nor was I trying to complicate things. I just thought that I was giving a complete answer as to how the feature works.
    After all - I could have just used the "please get the iPAD user guide" line.  I just love that response.

  • Changing color for data in sql developer

    I have recently seen some one have modified the setting in SQL developer to show certain color for the cells that have null values. Couldn't find where to set that property. Does anyone know how to default a color for a cell with null values in SQL developer?
    -app

    Go to Tools|Preferences|Database|Advanced. There is an option to set the null value background color.
    Ashley
    SQL Developer Team

  • How to set special rows in jtable not selectable

    Hello programmers,
    anybody knows how to set special rows(p.E. row 0) in jtable not selectable.
    in advance thanks for your answers

    table = new JTable(...)
         public void changeSelection(int row, int column, boolean toggle, boolean extend)
              if (row == 0)
                   return;
              else
                   super.changeSelection(row, column, toggle, extend);
    };

  • How to do i set or change colors for different events in iCal

    When i create a new event in iCal i want to assign it a specific color just like i do in Outlook under the heading of "Categorize". how do i do that in iCal and cna i do multiple colors like i do in Outlook?

    OK... got it... I use Microsoft Exchange set up by a 3rd party so i guess that is what the e-mail one is. I still use Outlook but eventually want to simplify. Right now i go back and forth between Outlook and iCal because Outlook still seems better to me. But hoping to have an open mind and find out how to use iCal more effectively. But i wonder if the local calenders are synced with the e-mail account. Is there anyway to move and/or combine the local calendars with my e-mail one so i have it all under "one roof" which means i can access all of it on my iphone, ipad, and computer and not have them appear as if thy are seperate?
    Thanks.

  • How to change colors for record working time calendar

    Hi,
    I would like to change the colors in the calendar displayed in record working time based on some conditions.
    How do i do that is there any BADI associated with that
    Thanks
    Bala Duvvuri

    Hi Bala ,
    Yes its possible to change that .
    You need to implement BADI for this ..
    BADI name : "PT_ABS_REQ"
    In the BADI "PT_ABS_REQ"   interface "IF_EX_PT_ABS_REQ" you can find the method
    "SET_CALENDAR_COLOR" in that you can set the colure for the Absent type ......
    Adjust Colors of Calendar and Team Calendar
    Functionality
    You can use this method to change the colors in the team calendar.
    In the standard system, the different statuses for requests have different colors. You can use this method to differentiate the colors of requests depending on the following aspects:
    Status of requests (status)
    Action that an employee has executed: new request, delete, change (UIA operation)
    Subtype of absence (SUBTY)
    Full-day or partial-day absence (BEGMT, where BEGMT = 0 signifies a full-day absence)
    Application mode ( mode). You specify the application mode in the Select Employees for the Team Calendar IMG activity.
    Color Display of Status of Leave Requests(COLORS_ACTIVE). You specify this status in the Specify How Leave Is Displayed and Default Values IMG activity.
    Available Colors
    You have a choice of 16 colors. The 16 colors are hard coded, that is, you cannot change them or add other ones.
    The available colors are stored with their RGB value as constants of the CL_PT_REQ_CONST class. Use these constants if you want to change the colors.
    Notes
    If you change the colors in the team calendar, you should also adapt the legend accordingly. You can use the Adjust Legend for Calendar and Team Calendar method to do so.
    Hope this work!!!

  • Change Color For HBox  in Sapui5

    Hi all,
    How the change the background color of HBox dynamically (Red,Green) depending on Status(0,1).
    Please Help me on this.
    Thanks
    Sathish

    Hi Dennis,
    In the above image i have used an hbox and i added that hbox to an rowrepeater.
    Now u can see an button in the HBox for which i have binded the text using an switch case if my status = 0 then the text shoukd be Allocate venue and if status = 1 then the text should be view venue.
    I have done upto this.
    Now the requirement is for the Records having Button text as Allocate then the entire row should be in red color and if text is view venue then that entire row should b in green color.
    How can i do this.
    Thanks
    Sathish

  • Howto change color for all elements

    I want to update the formatting for some existing Keynote presentations. Applying a new Theme does most of the work, but there are some things that are not updated to the new theme. For example: background color of certain text boxes -- and the color of actual bullets for bullet points.
    In the case of these presentations:
    - the background color of the textboxes is blue and I want them all to be transparent
    - the color of the bullets is blue and I want them all to be the default color/picture of the particular theme
    I realize this is because Keynote is "respecting" textbox formatting changes I have made in the original, but it would be nice if I could over-ride this "respect" somehow. It is easy to select all the text of a Keynote presentation and apply various ways to all the text. Is there a trick for selecting all textboxes (and changing the background color of them) -- or of specifying something to the effect of, "apply the following format to all the bullets in a presentation?

    Ok, in that file, you'll find a set of parameters that looks like this.
    sfa:r="1" sfa:g="0" sfa:b="0" sfa:a=".5"
    Those stand for the red, green, and blue of a color and the last one is the opacity. This particular combination would create a red object with 50 percent opacity. Still looking for which one of these controls the background of a text box.
    You know, it looks like if you go through the file searching for sf:fill and deleting that section, then that removes the fill. Once you find the right section, one find and replace would do it for you. It's one of those things that makes me wish I was handy enough with Automator and/or Applescript.
    Message was edited by: Kyn Drake

  • Changing colors for days in month view

    My work schedule fluctuates so that I don't work the same days every week during a month. Is there a way I can change the color of some of the days in month view so that I can quickly see my work days in ical?

    Welcome to the discussions, azstoneconsulting.
    In iCal colours are tied to specific calendars, so make a vacation calendar and a sick calendar (you forecast your sickness? Cool) and an out of office calendar and set the colours to whatever colour suits. Then when you are going to be in London select the out of office calendar and set it to last the four days. It will show as a coloured bar across those days in month view.
    AK

Maybe you are looking for

  • Can't power on

    display show gray color background only

  • Spaces With Extended Desktop

    Is there any way to keep the contents of your extended display the same when you change spaces on the primary display? I often watch movies on my TFT or HDTV while working on the other screen. Unfortunately when you switch to another space, the movie

  • Portal integration with Busniess Objects

    Hi, I have a customer who is looking for Oracle portal solution. They have an sso in place using Business Objects and they also have Active Directory for storing user information. They just want to login to Portal through SSO and access their Busines

  • Email Syncing issue

    Hotmail/Outlook emails do not update on the server when managed on iOS Mail. For example, a deleted or moved email on the iphone doesn't reflect as such on outlook.com. Does this have to do with it using POP? Is there a way to use IMAP instead on the

  • Send me the sample coding of DI Server

    Hi DI Server Experts, Can you send the sample simple coding for the DI Server and what are the steps needs to be taken care? i have DI server license and when i run the coding of sample it showing 'Could commit the transaction login'. Please helping