DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Posts
    29

    resizing JPanel not working

    Hi,

    I've got a JScrollPane with a JPanel set as its view. In this JPanel, I have a set of smaller panels layed out in rows. My program allows for the user to remove existing rows or add new rows to the parent JPanel. The problem I'm encountering is that when the user adds a new row, I need to resize the parent JPanel such that all rows are visible, but calling JPanel.setSize(int,int) or JPanel.setSize(new Dimension(int,int)) doesn't seem to do anything to the size of the parent JPanel. Is there anything special that must be done to JPanels that are views for a JScrollPane in order to see changes that are made to it? For example, do I need to call repaint(), do I need to set the view again (i.e. ScrollPane.getViewport().setView(MyParentPanel). I've tried these already, and I'm wondering if anyone has any other suggestions.

    Gib

  2. #2
    Join Date
    Sep 2004
    Posts
    223
    yeah i would have said repaint() but you have tried it eh? nothing happens? are you sure that your methods for adding another item are working?
    A kram a day keeps the doctor......guessing

  3. #3
    Join Date
    Jun 2004
    Posts
    29
    yes, because I shows the results of removing and item since that doesn't require resizing in order to make it visible. And when adding I have some System.out.println statements to track what's being added, and those seem to indicate it's working fine.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links