This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Scrollable JPanel using MigLayout  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been trying to create a chat client which makes use of a scrollable jpanel and at runtime adds JTextFields to the panel.

Panel Initialising


Adding text at runtime

But now Im facing the following issues
The text field aligns to the center of the panel & on adding more fields the panel accomodates as it can and does not begin scrolling.

Please help. thanks in advance
Screenshots attatched
2.jpg
[Thumbnail for 2.jpg]
Screenshot
3.jpg
[Thumbnail for 3.jpg]
I have entered messages up to u, but only visible till n
 
Sheriff
Posts: 21747
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JScrollPane uses its view component's preferred size to determine whether or not it needs to display scroll bars. Since you've set the preferred size to a specific value, that fixed value is used, and not the preferred size as determined by the layout manager. That means that even though the contents become larger, the preferred size remains the same and so still no scroll bars are needed.
 
Don't touch me. And dont' touch this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!