• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting size of a JTextPane

 
Richard Robbins
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried a few different things to get a JTextPane to appear with a set size, but none have worked. How does one create a JTextPane with a fixed size?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to use a null layout in the container that holds the JTextPane and call on the JTextPane. Then you will have to call on the container with the same height and width you used on the JTextPane earlier to get the container to show up correctly in other containers... heres a short example...

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