Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JScrollPane being ignored

 
Edmund Castermund
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2583
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic