Results 1 to 2 of 2
  1. #1
    eLancaster is offline Member
    Join Date
    Jan 2011
    Rep Power

    Default JList does not occupy all the space in the panel.

    I am making a Contact Book application, where a JList displays all the contacts. The JList is inside a JPanel, and the problem that i'm having is that it isn't occupying all the space. I've attached a picture to illustrate what I mean:

    JList does not occupy all the space in the panel.-contact-book.jpg

    Is there a way to fix this?

    The relevant code is as follows:

    Java Code:
    contactList = new JList(contactListModel);
    	ContactListCellRenderer renderer = new ContactListCellRenderer();
    	renderer.setPreferredSize(new Dimension(300,50));
    JPanel listPanel = new JPanel();
    Thanks for your help.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default Re: JList does not occupy all the space in the panel.

    You'll want to create and post an SSCCE for us to be able to do more than an ignorant guess as to your problem and its solution. I only hope and pray that you didn't create this gui with the NetBean's Swing code generator.

Similar Threads

  1. panel on a panel not visible
    By warchieflll in forum Advanced Java
    Replies: 2
    Last Post: 01-29-2011, 08:29 PM
  2. Link one JList to another JList
    By mib1bee in forum New To Java
    Replies: 1
    Last Post: 12-30-2010, 06:24 PM
  3. Add panel to parent panel
    By LovJava in forum AWT / Swing
    Replies: 10
    Last Post: 09-02-2010, 08:43 PM
  4. Adding a panel to a panel
    By rclausing in forum New To Java
    Replies: 7
    Last Post: 02-02-2010, 05:56 AM
  5. Replies: 0
    Last Post: 07-05-2009, 12:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts