Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextPane inside JScrollPane  RSS feed

 
Alexander D´┐Żubler
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I try to use a JTextPane within a JScrollPane - if I use the followinh code snippet, everything works fine:



However, the width of the JTextPane must be alterable (if I use the code snippet from above the JTextPane takes the full width of the application window).

I tried to add the JTextPane to a JPanel instance and assign this JPanel to the JScrollBar - however, in this case the JPanel is much too wide as its bounds are out of the JScrollBar's bounds on the right side.

Does anyone have a solution for my problem??
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm lost. You are asking about putting a JTextPane in a JScrollPane, and you reference code that does not do this.

Now, thinking about this, if you place a component on a JPanel and it is the only component and you give the JPanel a GridBagLayout but you don't set any constraints on the component, then I'd imagine it would just fill up the JPanel.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!