It's not a secret anymore!*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 82
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: 2154
    
    7
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.
 
jQuery in Action, 2nd edition
 
subject: JScrollPane being ignored
 
Similar Threads
How to Resize JScrollPane used in a JPanel?
New Image in JScrollPane
scroll pane in jpanel help
How to work with a ScrollPane in a SplitPane?
Is this really where actionlistener should go?