Results 1 to 3 of 3
  1. #1
    yontan8888 is offline Member
    Join Date
    Jan 2011
    Posts
    4
    Rep Power
    0

    Default i try to put JProgressBar i jtabl

    hello
    i try to put JProgressBar in row on jtabl but i can not do it
    way?


    I uploaded a picture
    http://www.up2me.co.il/images/4448366.png

    Thank you
    Yonatan

  2. #2
    NRitH is offline Senior Member
    Join Date
    Feb 2011
    Posts
    118
    Rep Power
    0

    Default

    By default, TableModel.getObjectAt() returns a String representation of the data in the cell. What you want is a custom TableCellRenderer. Here's how:

    1. Create a class that implements javax.swing.table.TableCellRenderer.
    2. Implement its getTableCellRendererComponent() to return an instance of your progress bar.
    3. Tell the table to use that custom cell renderer whenever it has to render a cell in that column. This is done by overriding Table.getCellRenderer().

    What I would do is subclass JProgressBar, have the subclass implement TableCellRenderer, and have getTableCellRendererComponent() just return this. That way, you can continue to use your progress bar as you did before, with the added benefit that it can do double duty as the cell renderer.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

Similar Threads

  1. Problem With JProgressBar
    By akssingh400 in forum AWT / Swing
    Replies: 6
    Last Post: 02-24-2011, 06:08 PM
  2. Load thread with JProgressBar
    By Dennis in forum Advanced Java
    Replies: 10
    Last Post: 10-09-2010, 09:32 AM
  3. JprogressBar
    By cotarelo in forum AWT / Swing
    Replies: 7
    Last Post: 03-26-2010, 03:13 AM
  4. JProgressBar inside a JDialog
    By Mikey_S in forum AWT / Swing
    Replies: 10
    Last Post: 07-13-2009, 02:55 PM
  5. Updating a JProgressBar from another thread?
    By Xiphias in forum AWT / Swing
    Replies: 3
    Last Post: 03-18-2009, 01:48 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
  •