开发者

Problem displaying Progressbar on Applet

I am displaying text data on a table for four columns(fields) . On the fifth column (field) of the table, I want to display a progressbar.

It means each individual item (row) on the table contains four different fields with text data & one field displaying progress bar.

My requirement is while uploading a file

file details(name , size , date ) are displayed for each file on a table & along with that for each file w开发者_JAVA百科hen it is uploaded , an individual progressbar also starts i.e. wrt to the specific file.

Currently am able to display the text data but the progress bar is not displayed ?

Text data is being displayed with the help of JLabel but the JProgressBar is not getting displayed on the same place . Is there any limitation on displaying the JProgressBar ?


As a side note you should note need the help of a JLabel to get the text data in the table. JTable can display that just fine with the default renderers.

Anyway, putting items like a JProgressBar into a JTable is going to be difficult as you will have to find some why to get the CellRenderer to keep painting that column to show the progress bar updates.

I think it would be easier to either:

  1. Just use a GridLayout and several panels to add your components and progress bars.
  2. Create a Cell Renderer that fills in a percentage of the cell with color based on the value in the cell. Then to update the progress, call setValue() for the cell that needs to increment the progress. This might not be as fancy as a progress bar, however, you might be able to use a JProgressBar as the CellRenderer component, but it might be tricky.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜