Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set the text in JTextarea from bottom.

 
Sandeepesh shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I just want to set the text into textarea start from bottom to top.
But i am not able to do it.what should i supposed to do or is there any other component of having the propert to set the text from bottom to top.

waiting for reply.......
 
Sandeepesh shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sandeepshah shah wrote:Hi All,
I just want to set the text into textarea start from bottom to top.
But i am not able to do it.what should i supposed to do or is there any other component of having the propert to set the text from bottom to top.

waiting for reply.......
 
Campbell Ritchie
Sheriff
Pie
Posts: 49451
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sandeepshah shah wrote:waiting for reply.......
And you expected a reply within an hour and twenty minutes?
 
Raphael Okochu
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot do that with the default jTextArea. You will have to extend the Class JTextArea. If you mean extracting the contents of a JTextArea, you can use a stack. Please you have to give more details.
 
Rob Spoor
Sheriff
Pie
Posts: 20552
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our GUI forum.
 
Paul Clapham
Sheriff
Posts: 21149
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Raphael is right. You should explain what it means to "set text into a JTextArea from bottom to top".
 
Sandeepesh shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I explain in more detailed what i want to do.

I have a JTextarea of setbounds width=200 and height =50.in which suppose i can write 5 line ok.

but my text generate dynamically it is not sure whether it will fit into 2 line 3 line or more.......

if suppose my dynamic text feet till 3 line and i have the height of Jtextarea is 50 which can hold 5number of line so the last
2 line will remain blank ok/

But i want to set my dynamic text from bottom to top.means all my three line should feet from line number 5,4,3

and my JTextarea will display the above two line blank and the last three line should hold my dynamic text......

for more clearity please check the attachment........

Filename: JtextareaAttachment.bmp
Description:
File size: 134 Kbytes
[Download JtextareaAttachment.bmp] Download Attachment
 
Sandeepesh shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In simple way:

String s ="First Line \n"+"Second Line \n"+"Third Line"; // The value of String s would be dynamic.
JTextArea jt = new JTextArea();
jt.setText(s);

please find the attachment
Filename: JtextareaAttachment.bmp
Description:
File size: 134 Kbytes
[Download JtextareaAttachment.bmp] Download Attachment
 
Maneesh Godbole
Saloon Keeper
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At run time, figure out how many lines of text you got. Based on that, prepend those many \n to your text and then set it to the text area. You will need to work out the linewrap problem though.
 
Sandeepesh shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank's I hope it should work.
 
Maneesh Godbole
Saloon Keeper
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sandeepshah shah wrote:

Please check your private messages for an important administrative matter.
 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic