Results 1 to 1 of 1
  1. #1
    Nozz is offline Member
    Join Date
    Apr 2014
    Posts
    49
    Rep Power
    0

    Default Color from table?

    Hi,
    I'm trying to get background color from table of colors, but I can't.

    Lets start with something like this:
    Java Code:
    String colors[] = {"red","white","blue"};
    Color selectedColor = Color.colors[1];
    Returns:
    colors cannot be resolved or is not a field

    I can use:
    Java Code:
    String colors[] = {"red","white","blue"};
    Color selectedColor = Color.red;
    And it works. Bit while I'm trying to use table or variable it doesn't.
    How can I do this?
    K, solved.
    I can't belive noone anywhere didn't wrote it... Well, at least there where I have looked for it.

    Solution:
    Java Code:
    Color selectedColor[] = {Color.gray, Color.red, Color.black};
    setBackground(selectedColor[0]);
    Last edited by Nozz; 04-01-2014 at 09:38 PM.

Similar Threads

  1. Regarding color, font and size in table
    By sas in forum New To Java
    Replies: 4
    Last Post: 04-05-2011, 03:59 PM
  2. Replies: 3
    Last Post: 04-05-2011, 03:46 PM
  3. table bg color
    By Stephen Douglas in forum New To Java
    Replies: 5
    Last Post: 06-22-2010, 08:39 PM
  4. [COLOR="Navy"]execute .bat file in mysql [/COLOR]
    By msankar.ravi in forum Networking
    Replies: 0
    Last Post: 02-24-2010, 05:27 AM
  5. Color cells and rows in SWT table
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-11-2008, 05:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •