JTable - Can I change the color of the text on a row by row basis?

Hi All,
I'm redoing a bit of old uni coursework (to model a stockmarket, stock ticker server & stock ticker application) to brush up my Java skills (esp Swing and Event Handling) and am programming the UI by hand using Swing (its the only way to learn something....(I've certianly nailed Layout Management!!))
In the stocktickerserver GUI I'm using a JTable to display the details about stocks.
The user can select a stock and view the details of the stock in another frame. In one panel in the JFrame I've got a JTable listing the history items for the stock (Price, Change, Date).
Is it possible to color the rows of the JTable according to the value of the change column (or at least the value I insert there)?
e.g
if (change > 0){
Blue;
else{
if (change < 0){
Red;
else{
Green;
I'm completly ignorant on how to achieve this (or even if its possible at all) so all your ideas welcome.
Any help much appreciated
Pete
P.S.
The Stock History is a class that I store in a [private] Vector in the Stock Class.
For the selected Stock I loop through this vector getting the items (using various accessor methods)
I extract the values from the return StockHistory object and build a DefaultTableModel from these
Then I call JTable.setModel(theModel) to build the table

implement TableCellRenderer and change foreground of the Renderer in the method getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) . Install this renderer to your table.

Similar Messages

  • How can I change background color of the cover in ibooks Author?

    I'm trying to change the color of the background of the cover of the iBook I'm creating. I can't find how to.
    Please help.
    Gaby

    Gaby -
    Click on Book Title, unlock it, delete.
    Select a square graphic, turn Object causes wrap off.
    Make the square any color you like.
    Enlarge it to cover the page.
    Send to back. Lock it down.
    That's it.
    Now go here and download this free book, Publishing With iBooks Author, from O'Reilly press.
    http://shop.oreilly.com/product/0636920025597.do?sortby=publicationDate
    - Fabe

  • How can I change background color for a text field

    Hi I tried this
    style="BACKGROUND-COLOR:#00FFFF"
    working fine in IE
    but not working in Netscape.. any other way to set the background color?

    Netscape 4.x does not support this feature. Only Netscape 6.x does.

  • How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)

    Hello,
    Here is the problematic:
    1° How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)
    - I've many button in a doc im creating
    - the color of the buttons is white with black stoke & black text
    - in roll over state i want them to inverse the color coding (the text white & bottom black)
    - currently the text becomes invisible as black on black cant be seen (ive stroked it white but that looks ugly)
    - i would just like to know if there is a function made for this?
    My other questions:
    2° Ive a presentation on which Ive created buttons which tigger pop-up animations
    - i have 5 buttons which trigger animations
    - the viewer can chose to Click on any of the buttons randomly
    - the problem is once the animation is open how can it be close... either:
    a) by it self after "40" seconds
    b) when ther viewer clicks another button
    3° Ive created buttons linking pages..
    - "go to page xxx"
    - when i do a preview and click on the buttons the links dont take me to the right pages
    - is that normal? (maybe in preview its suppose to be like that)
    4° I would like to intergrate YouTube videos in the presentation so they play inside the docment.. when i tried.. it said the 'link isnt a flash video'
    - what should i do?
    5° Once i export it into Swf. how how can i visualize it? or put it online?
    Thank you for your time.

    stlbbl4u wrote:
    Hello,
    Here is the problematic:
    1° How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)
    - I've many button in a doc im creating
    - the color of the buttons is white with black stoke & black text
    - in roll over state i want them to inverse the color coding (the text white & bottom black)
    - currently the text becomes invisible as black on black cant be seen (ive stroked it white but that looks ugly)
    - i would just like to know if there is a function made for this?
    You should setup Object Styles - these can also include Paragarph Styles that can be triggered when the Style is selected.
    http://help.adobe.com/en_US/indesign/cs/using/WS5CEDB81A-0011-4dc9-9DE8-AC7AD4C80076a.html
    My other questions:
    2° Ive a presentation on which Ive created buttons which tigger pop-up animations
    - i have 5 buttons which trigger animations
    - the viewer can chose to Click on any of the buttons randomly
    - the problem is once the animation is open how can it be close... either:
    a) by it self after "40" seconds
    b) when ther viewer clicks another button
    I'm not sure what you mean - I don't do files with Animations
    3° Ive created buttons linking pages..- "go to page xxx"
    - when i do a preview and click on the buttons the links dont take me to the right pages
    - is that normal? (maybe in preview its suppose to be like that)
    Does it work properly when you export it to the finished file?
    4° I would like to intergrate YouTube videos in the presentation so they play inside the docment.. when i tried.. it said the 'link isnt a flash video'- what should i do?
    InDesign won't link directly to youtube videos. I think your best bet would be to use Downloader to download the video and embed them directly in Indesign.
    5° Once i export it into Swf. how how can i visualize it? or put it online? 
    Thank you for your time.
    You can look up how to embed a SWF file into your HTML - but it depends what you mean by "online" there's a dozen ways to get a file "online".

  • How can I change the color of a folder icon and also the color of the text

    I am using Yosemite.  Is there any way to change the color of a folder icon and also the color of the text?

    You can't. You can't individually set the properties of just one array element.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How can I change the color of the new tab button?

    Hi,
    I was wondering if there was a way to change the color of the new tab button, list all tab button, and tab groups button. I have been searching for personas that don't make it hard to see those particular buttons for days now, but since I can't seem to find any I was hoping there was a way to change those buttons' colors to make them more visible with the personas.
    [http://i54.tinypic.com/2ui9351.jpg Here's a picture of the situation]
    I want to change those 3 buttons (and the "show more bookmarks" button that appears when the window is too small to show them all) to white or some other more visible color. I know there's a way to change the background of those buttons, but I'd prefer if I could change the '+' button itself in the new tab button for example. Is there any way to do it? Because it's so hard to find personas that don't make it hard to see text or buttons.
    Thanks.

    jus an example
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com
    Attachments:
    Blinking_Indicator_2003.vi ‏27 KB

  • How can i change the color of the graph in agreement of the program's condition

    Hi,
    I am using labview 5.1 in my graduation's project final. (sorry by my english, but i am ina hurry)
    How can i change the color of the graph in agreement of the program's condition?
    I am developing a VI to control the temperature of termistors,but i have another sensor too.
    In a graph i have the situation of the termistors,but i want to change the color of the graph when the sensor is active.
    Thanks a lot
    Rafael Wajnsztajn - Brasil

    To change the color of the line itself, you can use the attribute Plot>>Plot Color.
    To change the color of the points, you can use the attribute Cursor>>Cursor Color.
    To select the color, you should have a color box constant inside the Numeric>>Additional Numeric Constants palette.
    This is all in LV 7.0. I'm not sure how it similar it is in 5.1.
    One important thing is to place the attribute node inside a case structure which will execute only when your condition has been filled.
    If this didn't help you, I suggest you post the relevant piece of code, or at least an image of it (no BMPs, please).
    Try to take over the world!

  • How can I change the color of the Integration Builder?

    Watch this blog: /people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
    While reading this blog I notice that the IB is of a different color. I would like to use this feature to differ my systems by color. How can I change the color of the IB?

    hi,
    you can always try <b>the Felix's way</b> )
    /people/sap.user72/blog/2005/12/11/how-to-apply-themes-in-exchange-infrastructure
    is that what you need?
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Writing email on ipad can I change the color of the text?n email on ipad can I change the color of the text?

    When writing an email on ipad can I change the color of the text half way through to highlight relevant detail?
    If so, how?
    I have looked and looked.....
    Thanks,
    Belinda

    If you're in the US
    You can get information about an order you placed on the Apple Online Store through the Order Status page. If you prefer, you can also get order status or make changes by phone at 1-800-692-7753.
    Contact them and ask.

  • Can i change the color of the text bubble?

    I recently updated the iphone 4S with the new upgrade.  Is there a way to change the color of the text bubble from that hideous green?

    No, unfortunately not...
    Green means SMS and blue means it's an iMessage but it's not customizable.
    You can leave feedback for Apple though about it if you like at:  www.apple.com/feedback
    Good luck!

  • Flash CS4 - Can I change the colors of the background or text that shows up in the Layers section?

    I am stuggling here!  I am colorblind.  I need to change either the color of the background or the color of the text on the layers section on the Timeline.  I simply cannot read/see what is currently showing.  It is a very light blue background with white text and white dots for seeing, locking, or setting the outline color.  I need to either change the text color and dots to black so I can see them, or try to change the background color to a dark blue so I can read the white text.  Changing the text color would really be my preference.  How do I do this?   Please help.  Adobe hasn't been very concerned about colorblindness when developing these products.  I can barely make out all the light grey/grey/dark grey/grey stuff.  Now this! 

    For Windows you can adjust your Theme (or download a new one and use that). This will alter the color of each layer, for example if you use Classic then it will use a very dark blue for layers that will provide higher contrast. I've downloaded other custom themes in the past that use a very dark grey for example.
    (By the way, for Mac users go to Appearance in System Prefs and choose a different Highlight color - you can choose a default or custom one. That color is used for the layer color).

  • Search bar backgroub dont show what i write, can this be change or the color of the letters can be change to black instead of white so i can see what i write?

    when i open my Firefox browser i got Google as my home page and search engine so i click at the search bar and start typing, but i cant see what i write. i think this is do to the background of the search bar and also to the color of the letters which is white.
    i have been trying to change this but i don't find the tools to do it and/or i don't have the knowledge to do it, thanks for you help.

    Are you using a theme or persona that may set the color to white?
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Such issues can also be caused by the "Keystroke protection" in Comcast Constant Guard.
    "Configure Anti-Keylogging Settings" -> disable
    *[[/questions/874709]]
    *[[/questions/870165]]

  • How do I change the colors of Ring texts individually so when it pulls down, I can see each test with different background color?

    I have been using LabView for a almost 18 months now. There was no problem which I could not solve with help of all resources available. But, this is one where I am scratching my head since long time now.
    I would like to change colors of each individual text in Ring control programmatically. I have attached example VI. In this VI, I change background color of ring text, but it changes only the current (active) background color, so when you pull down the whole menu, it shows same default color for all the text background (not even the color I asked it to). Is there anyway I can define individually as to what color should be related to each text in ring menu?
    Attachments:
    Ring Menu Colors.JPG ‏16 KB
    RGB Ring.vi ‏33 KB

    " Is there anyway I can define individually as to what color should be related to each text in ring menu?"
    Well not with a ring and not programatically.
    The best I can suggest is a picture ring, see below.
    Ben
    Message Edited by Ben on 11-18-2005 02:16 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Picture Ring.JPG ‏5 KB

  • Enhanced Video podcast with chapters..can we change the color of the text?

    Enhanced Video podcast with chapters..can we change the color of the text? Yo know when yo make a marker and then name it and put in the url name an then the url. Well it looks great on GB but when it is exported it is always blue and you cant see it very well. Am I a silly boy or is there some way we can change that color?
    http://www.galacticmac.com
    20" 2GHz Intel Core Duo   Mac OS X (10.4.10)  

    Hi there
    Sorry, but your post seemed to initially infer you were just referring to a Button you would insert on a page. At least that's what I understood when I posted with what I did.
    Now it would seem you are referring to the Playback Controls that Captivate supplies? So either I grossly misunderstood your initial issue or you are now switching gears and asking about something different.
    What I posted earlier does not apply to the Captivate Playback Controls.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • Can we change the color of the Warning Messages?

    Hi, I had a requirement to change the Color of the warning messages to be in Red. Can somebody suggest on how to do this and also can we do this for one module specific?
    Thankyou

    following statement would show the message in Red Color.
    throw new OAException("Warning Message",OAException.ERROR);
    Use OAAttrValException if you want to highlight the particular field is wrong.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can we change the  color of the image for product display for different

    Hi All,
    How can we change the  color of the image for product display for different colors, to be displayed on site.
    jeff

    Hi priya,
    The requirement that you have stated is not a standard feature in ISA CRM. In order to do the same, you will need to modify the standard ISA code in Java. A common path for the solution would be as follows:
    1. Colours
        a. Maintain a text type for Color under the object - PCAT_ITM in Customizing.
        b. Modify the standard search of ISA to search within your new text type as well. (In standard it only searches in Description.
       c. Maintain all shirts colour data in the new type created in step a.
       d. Your requirement will be done!
    2. Price
      a. Use list prices for your shop and assign the appropriate condition type, acces in your catalog.
      b. Modify the standard search of ISA to search on the list prices as well.
      c. This too will be done!
    3. Accessories - This is very tricky, and will require some exploration. However, here's my opinion,
    a. Search for the standard function module, which will return the accessories when provided the product as an input.
    b. Modify this function module according to your requirement and ensure that it can be accessed remotely.
    c. Modify the JSP as in steps 1b and 2b above to call this new remote-enabled function module.
    d. Now you're done!!
    The ISA modification part is not so simple, you need a really good guy like "Sateesh Chandra" who'll be able to handle your requirements. This is all I could manage, hope it is some help to you!
    Thanks & Regards,
    Nelson.

Maybe you are looking for

  • E-Recruitment 6.0

    Hi, We are experiencing intermittent errors in our e-recruitment system. When a recruiter creates an activity, everything on screen looks ok. There are no error messages nor any indication that something is wrong. However, there are times when these

  • Creating Save Button Does Not Work - HELP!

    I am trying to create a button that will execute "Save As." I have added a regular button, and at the "click" option I enter: app.executeMenuItem("SaveAs"). The error message I get is "Script failed (language is formcalc; context is xfa[a].form[0].fo

  • Exception class help

    Hi, i create exception class like it write in the sap help and when i want to send the exception with parameters to the ABOVE METHODS i don't susses  i just get the message without the parameter ? there is simple guideline how o transfer the exceptio

  • Loader problem

    i am making a photo gallery. I load photos to a Loader by getting links from XML. My problem is this that while photos are being loaded, when next photo comes, previous one do not dissapear, can you help me to solve this problem?

  • S067 not updated

    Hi In OMO1 t.code ... show the all infostructures s066 is updated ... but s067 not updated.. how can i update this s067 structure ..pls guide meanu one  in this updation procedure thatnks and regards sesi