Win a copy of Design for the Mind this week in the Design forum!
  • 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 table and a text area in a split pane. i have it set up where if you click on a row, it appends info to the table. well, i see now that it appends it to the bottome of the current text. i am trying to use the replaceRange()method with getlineendoffset() and getlinestartoffset(). how do you use them so that it will at least compile. basically i want the text to be replaced with different text if you click on a different row.
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try setText("") then load it with the new.
 
keiyia jackson
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does it matter that it is a textarea not textfield
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. They are both JTextComponents which is where the method is inherited from.
 
Javaoops
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
keiyia, I want to clarify whether the textarea contains text other than the selected row detail.
If no, then to replace the textarea text with the current selection row detail instead of appending, on each selection of row replace the text with new selection details.
textarea.setText(selected row detail);

 
keiyia jackson
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I already got it. but thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic