Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jtable Rendering

 
Bubi gupta
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand why you are worried about this. getTableCellRendererComponent is called by Swing during a repaint, not by you.
 
Bubi gupta
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2564
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody please help me in clarifying my above posted question ? I am really having trouble catching the concept?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic