Results 1 to 4 of 4

Thread: jtable

  1. #1
    bonjovi4u is offline Member
    Join Date
    Mar 2010
    Posts
    28
    Rep Power
    0

    Default jtable

    he pals,

    can any one help me out with the this task??

    i have to blink the specfic cell in jtable..

    say the index of the cell is 2,2

    i have tried the following code.. but it is not working


    while(true)
    {
    ((Component) tableclassobject.jTable1.getCellRenderer(row, col)).setBackground(Color.red);
    Thread.sleep(50);

    ((Component) tableclassobject.jTable1.getCellRenderer(row, col)).setBackground(Color.white);
    }

    insted of blink one cell its results in colouring the whole table red!

    can any one help me out with this?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Never, never use while (true) or Thread.sleep on the EDT (the event dispatch thread -- Swing's main thread) as all this will do is put your whole application to sleep.

    Use a Swing Timer inside the renderer instead.

  3. #3
    bonjovi4u is offline Member
    Join Date
    Mar 2010
    Posts
    28
    Rep Power
    0

    Default

    can u help explain it with the help of an example?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Quote Originally Posted by bonjovi4u View Post
    can u help explain it with the help of an example?
    Wish I could but like most of the volunteers here I have significant time constraints. Since we're not paid but are volunteers, the brunt of effort here needs to be on the person asking the question, and in that light, your best bet is to read the Sun/Oracle tutorials on how to use Swing Timers and table renderers and then try it yourself in a small demo program to test the concept. If this doesn't work, then post this small test program here and we can help you.

Similar Threads

  1. JTable
    By amitabh in forum NetBeans
    Replies: 2
    Last Post: 05-28-2010, 02:28 PM
  2. Adding New JTable in JTable
    By anilkumar_vist in forum New To Java
    Replies: 0
    Last Post: 01-27-2010, 08:27 AM
  3. JTable
    By hedonist in forum New To Java
    Replies: 3
    Last Post: 10-27-2009, 11:30 PM
  4. Regarding JTable
    By adeeb in forum AWT / Swing
    Replies: 12
    Last Post: 06-19-2008, 07:39 AM
  5. Replies: 2
    Last Post: 05-15-2008, 10:15 AM

Posting Permissions

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