This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTextPane inside JScrollPane Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "JTextPane inside JScrollPane" Watch "JTextPane inside JScrollPane" New topic
Author

JTextPane inside JScrollPane

Alexander D�ubler
Greenhorn

Joined: Feb 15, 2006
Posts: 11
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

Joined: Jul 11, 2001
Posts: 15230

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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JTextPane inside JScrollPane
 
Similar Threads
Manually sizing JScrollPane
JTable rows are getting visible in the middile of the JFrame only
JScrollPanes sync in development but not in live environment
JScrollPane inside JTabbedPane
Panel in ScrollPane