Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems Resizing TextArea

 
Ben David
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I cant seem to resize a text area box.

I tried resizing the text area and the panel that I put it in.

What am I doing wrong?




method







whole class
 
Rob Spoor
Sheriff
Pie
Posts: 20605
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
99.99% of the layout managers ignore the size set specifically, and only look at the preferred size.
 
Ben David
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! I will look into preffered size next time I have a problem.

I ended up specifying columns and rows in the TextArea Constructor.




 
Rob Spoor
Sheriff
Pie
Posts: 20605
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using TextArea and not JTextArea? It's a bad idea to mix AWT components (like TextArea) with Swing components (like JPanel).
 
Ben David
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:Why are you using TextArea and not JTextArea? It's a bad idea to mix AWT components (like TextArea) with Swing components (like JPanel).


oops. that was a newb mistake. Thanks for the pointer!

I changed it to a swing JTextArea.

Now I just need to put it inside a JScrollPane to get a scroll bar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic