Results 1 to 6 of 6

Thread: table bg color

  1. #1
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Default table bg color

    G]

    how can i make the color of the background of the jtable "white" . i am working on netbeans.
    please suggest.
    thanx.
    The Quieter you become the more you are able to hear !

  2. #2
    Sno's Avatar
    Sno
    Sno is offline Senior Member
    Join Date
    Apr 2010
    Posts
    196
    Rep Power
    4

    Default

    I don't have any of my code, but look up .viewPort you want to change for the background

    JTable and TableModel: FAQ
    :rolleyes: ~ Sno ~ :rolleyes:
    '-~ B.S. Computer Science ~-'

  3. #3
    berkeleybross's Avatar
    berkeleybross is offline Senior Member
    Join Date
    Feb 2010
    Location
    England
    Posts
    187
    Rep Power
    5

    Default

    Do you mean the background colour of the cell, or the bit behind the cells?

    i think you can adjust the bit behind cells using
    Java Code:
    getViewport().setBackground(Color.white);
    For cells its slightly more complicated, and have to use cell renderers.

  4. #4
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Default




    i mean below the visible table.. or the matrix
    The Quieter you become the more you are able to hear !

  5. #5
    berkeleybross's Avatar
    berkeleybross is offline Senior Member
    Join Date
    Feb 2010
    Location
    England
    Posts
    187
    Rep Power
    5

    Default

    If the table is in a scroll pane (like netbeans makes them) then you need to get the scrollpanes viewport and set its background to white.

    Putting the code at the end of the initComponents method generated by netbeans should work
    Java Code:
    scrollPane.getViewport().setBackground(Color.white);

  6. #6
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Default

    thnx it worked.:)
    The Quieter you become the more you are able to hear !

Similar Threads

  1. if (...) ... won't set color
    By livingdog in forum New To Java
    Replies: 6
    Last Post: 04-11-2010, 03:59 PM
  2. RGB from Color Name
    By winklerd in forum Advanced Java
    Replies: 5
    Last Post: 03-26-2010, 05:16 PM
  3. [COLOR="Navy"]execute .bat file in mysql [/COLOR]
    By msankar.ravi in forum Networking
    Replies: 0
    Last Post: 02-24-2010, 04:27 AM
  4. Replies: 1
    Last Post: 01-08-2010, 06:19 AM
  5. Color cells and rows in SWT table
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-11-2008, 04: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
  •