wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes JScrollPane being ignored Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JScrollPane being ignored" Watch "JScrollPane being ignored" New topic
Author

JScrollPane being ignored

Edmund Castermund
Ranch Hand

Joined: May 09, 2007
Posts: 85
Hi,
I have an app that displays a JPanel which changes it's text depending on which element of a JList a user selects. I create the JLabel, add it to the panel, and after it's created, the labels text is updated via a method using the setText() method.

Here's the relevant code:



when the app first fires up, the scroll pane is created, but doesn't appear, because nothing is selected. But when the user selects something from the list that is too big to fit in the default size of the panel, the scroll pane does not appear. Any idea how I can fix this?
bp
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
Try using a JEditorPane to display HTML, not a JLabel.

If you need further help then you need to create a SSCCE (Short, Self Contained, Compilable and Executable, Example Program), that demonstrates the incorrect behaviour.

Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JScrollPane being ignored