Results 1 to 4 of 4
  1. #1
    knuth is offline Member
    Join Date
    Sep 2009
    Posts
    8
    Rep Power
    0

    Default JScrollpane auto resize

    Maybe a simple question, but I could not find an answer anywhere:
    I have a JScrollpane, and when the parent frame is resized, the scrollpane should do so as well - just like panels do.
    I experimented with weightx, without success..
    Any ideas?

    Cheers
    Knut

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default

    A scroll pane works the same way as a panel does, so if you know how to do it with a panel I'm not sure what your problem is.

    The easiest solution is to add the scroll pane to the center of a BorderLayout.

  3. #3
    knuth is offline Member
    Join Date
    Sep 2009
    Posts
    8
    Rep Power
    0

    Default

    getContentPane().add(scrollPane,BorderLayout.CENTE R);

    Does not work :confused: The scrollPane still has a static size.

  4. #4
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default

    Of course it works. You have done something else wrong. Post your SSCCE. If you don't know what a SSCCE is then search the web.

Similar Threads

  1. jscrollpane
    By kaemonsaionji in forum New To Java
    Replies: 3
    Last Post: 02-25-2009, 09:39 AM
  2. Getting JScrollPane to stop auto-scrolling
    By Shadow in forum AWT / Swing
    Replies: 8
    Last Post: 10-21-2008, 09:52 PM
  3. Auto-complete/Auto-fix for custom statement
    By dark_cybernetics in forum Eclipse
    Replies: 0
    Last Post: 08-19-2008, 12:19 PM
  4. help with JScrollPane
    By tommy in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 08:58 PM
  5. Resize frame
    By lenny in forum AWT / Swing
    Replies: 1
    Last Post: 07-30-2007, 12:18 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
  •