Results 1 to 3 of 3
  1. #1
    tom2zip is offline Member
    Join Date
    Nov 2011
    Posts
    11
    Rep Power
    0

    Default JList with a scrollbar

    i think this code should work, but it doesn't and i have no idea why
    can someone help me?
    Java Code:
            final JList listArea = new JList(listModel);
    		GridBagConstraints gbc_listArea = new GridBagConstraints();
    		gbc_listArea.fill = GridBagConstraints.BOTH;
    		gbc_listArea.insets = new Insets(0, 0, 5, 0);
    		gbc_listArea.gridwidth = 4;
    		gbc_listArea.gridx = 0;
    		gbc_listArea.gridy = 1;
    		JScrollPane scroll= new JScrollPane(listArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    		panel.add(scroll, gbc_listArea);
    		listArea.setCellRenderer(new CustomListRenderer());
    		
    		listArea.setPreferredSize(new Dimension(20, 30));

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,250
    Rep Power
    19

    Default Re: JList with a scrollbar

    tom2zip, you have inconclusively abandoned every single thread you have started on this forum, and never expressed thanks to those who tried to help and advise you.

    Not the best way to continue to get help, that.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 4
    Last Post: 01-10-2012, 01:05 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. scrollbar not coming on jlist
    By silversurfer2in in forum AWT / Swing
    Replies: 8
    Last Post: 06-22-2010, 11:07 AM
  4. ScrollBar in a JList
    By lupo in forum AWT / Swing
    Replies: 2
    Last Post: 05-20-2010, 10:42 PM
  5. JList with ScrollBar
    By Psyclone in forum AWT / Swing
    Replies: 5
    Last Post: 02-12-2010, 04:02 AM

Posting Permissions

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