Results 1 to 4 of 4
  1. #1
    jiexx is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default Not another Jpanel Scrollbar problem!

    I am using Netbeans gui designer
    I create a new JDialog
    inserted a panel in the middle which i require to be scrollable as it gets larger and filled with components

    So when i enter the panels Customized Code this is what i have
    Java Code:
    jPanel16 = new javax.swing.JPanel();
    
    jPanel16.setBackground(new java.awt.Color(255, 153, 153));
    
    jPanel16.setMaximumSize(new java.awt.Dimension(520, 270));
    
    JScrollPane sp = new JScrollPane(jPanel16, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    What else do i have to do.. I've tried a million things and still no scrollbar appears! Please help me its urgent

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

    Default

    1) Are you placing the JPanel inside of a JScrollPane?
    2) Have you read the Sun Swing tutorial on how to use scrollpanes?
    3) Have you tried setting the preferredSize of components in particular the JPanel placed in the JScrollPane?

  3. #3
    jiexx is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default

    Perfect set of questions :)
    Thanks for pointing me in the right direction fuburable!
    just cant believe this took me so long to figure out :(

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

Similar Threads

  1. Problem on adding JButton on JPanel NEED HELP
    By boisk in forum AWT / Swing
    Replies: 15
    Last Post: 03-15-2009, 02:27 PM
  2. how to add scrollbar in netbeans
    By kumar_gemi in forum NetBeans
    Replies: 1
    Last Post: 03-12-2009, 06:50 PM
  3. JFileChooser horizontal scrollbar problem
    By nenadm in forum AWT / Swing
    Replies: 4
    Last Post: 11-12-2008, 11:16 AM
  4. Using java.awt.Scrollbar
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-03-2008, 09:19 AM
  5. Problem with JPanel
    By ibanez270dx in forum New To Java
    Replies: 2
    Last Post: 11-09-2007, 05:04 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
  •