• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable/Column modification /urgent  RSS feed

 
Sonara Rahul
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends,
I have a problem in JTable.I have to make a particular cell multiline in JTable.
How colud i do this.
I have 2 columns & many rows in JTable.In second column all or a particular row should be multiline.
How colud i do this.
Excepting u'r replies,
with regards,
Sonara.


 
Jagan Reddy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender. refer TableDialogEditDemo.java example.
The above gives an examples of how to use different editors on a column. If u can make use of a text area i think your problem of multi line can be solved.
Regards,
Jagan Mohan Reddy.
 
cinderalla
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friend,
Thanks for u'r reply.It's working fine.Now i need one more help from u.In JTable when any column is selected i need to do one event,else that event shouldn't be triggered.
Any row or column is selected means this should happen.
there r isselected(rowcount,columncount) methods.But i don't have to specify the row or column count.If any row or column is selected i need to make a event happen.
How can i get this.
Excepting u'r reply,
cinderalla.
 
Jagan Reddy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Add the TableModelListner to your table.
get the selectedRow using getSelectedRow()
get the selectedColumn using getSelectedColumn()..
Depending upon your requirement of the row and column fire your events..
If this is what you want,then i hope this solves your problem..
else can you be much more clear in your question.
Regards,
Jagan Mohan Reddy
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!