• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jtable, Jtextarea

 
keiyia jackson
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a SplitPane with a Table on the right and a TextArea on the left. I need to click on a row in the colums and output info to the textarea. Any suggestions.
 
Javaoops
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try out !!!



 
Javaoops
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
// Constructs a new text area with the specified text.
textAreaVariable=new TextArea(buf.toString())
// To Append the given string to the text area's current text
textAreaVariable =textAreaVariable.append(buf.toString())
 
keiyia jackson
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the code:
int selectedRow = table.getSelectedRow();
int colCount = getColumnCount();
StringBuffer buf = new StringBuffer();
For(int count =0;countbuf.append(table.getValueAt (selectedRow,count));
}
// Constructs a new text area with the specified text.
=new TextArea(buf.toString())
// To Append the given string to the text area's current text.
=.append(buf.toString())
what is countbuf and count and don't i need to increment this somehow.
 
Javaoops
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Why the count variable : it is of the column count. Each and every column data of the row to be added to the string buffer variable. Convert stringbuffer to string inorder to store the text in the textarea.
method 1 : to construct a text area containing only the current selected row.
method 2 : adds the currently selected row along with previous text of text area variable.
In the code less than symbol is not displayed properly, so i have written as less than(in words) , so substitute the less than symbol in your coding.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!