This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting size of a JTextPane  RSS feed

 
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!