DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004

    resizing JPanel not working


    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.


  2. #2
    Join Date
    Sep 2004
    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
    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.

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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.