File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Jtable Rendering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jtable Rendering" Watch "Jtable Rendering" New topic
Author

Jtable Rendering

Bubi gupta
Greenhorn

Joined: Sep 21, 2009
Posts: 14
Normally in table cell rendering we implement this method getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column).The Object value parameter in the method is probably retrieved from the Object getValueAt(int rowIndex, int columnIndex) method in the Table modal.

Hence inoder to get the exact specific cell datas from the entire table the rowIndex and columnIndex should increment also and this values I think are actually passed to the parameter (Object value) in the method getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column).

I am not getting any idea actually how the rowIndex and the columnIndex in this method Object getValueAt(int rowIndex, int columnIndex) is automatically incrementing?Because this changed value is ultimately passed to the getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column).

Please help me out with this problem.I am not getting any clear help from any source.
Thanks in advance


Thanks a lot in advance for your support
BUBI gupta
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I don't understand why you are worried about this. getTableCellRendererComponent is called by Swing during a repaint, not by you.


[My Blog]
All roads lead to JavaRanch
Bubi gupta
Greenhorn

Joined: Sep 21, 2009
Posts: 14
Actually am trying to figure out how the parameters are set in the method getTableCellRendererComponent ().Actually this method has a parameter "Object value" which changes continuosly .This value is supplied from the Tabel Model I believe.So I want to know what actually is the relation?
And who actually changes the parameter in the getValueAt(int rowIndex, int columnIndex) method in the Table modal i.e how the rowIndex and columnIndex values are changing.

The actual picture is not very clear.Please help me('');
Thanks a lot in advance.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2182
    
    7
Again, why do you care? What problem are you trying to solve?

The JTable UI will invoke that method with the proper values, whenever it determines that a cell needs to be repainted. Look at the source code of BasicTableUI if you want to understand the painting logic. Good luck.
Bubi gupta
Greenhorn

Joined: Sep 21, 2009
Posts: 14
Thanks for all your valuable reply.
Just one thing I like to know that so I should not be bothered about the method calls of the
getValueAt(int rowIndex, int columnIndex) in the table model and the getTableCellRendererComponent () method in the renderer.
I should assume that how the parameters in those method increments is solely determined by java's own UI logic during rendering.
I should not be much bothered about that wright?('');

One more thing,so basically what things I need to keep in mind during the usages of this method?Just what they do or any specific thing during the method handling?

Thanks once again in advance for you support.

Bubi gupta
Greenhorn

Joined: Sep 21, 2009
Posts: 14
Can anybody please help me in clarifying my above posted question ? I am really having trouble catching the concept?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jtable Rendering