Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: JScrollPane width won't reduce with window

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JScrollPane width won't reduce with window

    I am using NetBeans 7.0.1 to create a GUI application. Within the main frame I have a JPanel which contains a JScrollPane which contains a JTree. The issue is that when I resize the running application window, the tree will get bigger with the window and I can see the scroll bars. Whn I reduce the window size, the horizontal scrolbar will move up all the to the top of the scrollpane and can be seen but the vertical scrollbar moves in only so far and then disappears to the side. Plus the horizontal scrollbar never hows a slider. It acts as if the scrollpane will only reduce so far and then the right side of it is not visible because it is outside of the visible window. I have tried all sorts of things with maximumsize, minimumsize, preferredsize, etc. Nothing has worked. Any help?


  2. #2
    Junior Member
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JScrollPane width won't reduce with window

    I figured it out.

    A couple things I failed to mention in the first place.
    I created a Java Desktop Application in netBeans. This creates a JDesktop Application that starts with a main FrameView that has a MenuBar (JMneuBar), a mainPanel (JPanel), and a statusBar (JPanel). Inside the mainPanel, I added a JPanel with a couple labels and a JComboBox. Below that JPanel, I added the JScrollPane with the JTree inside that.

    It was the first JPanel that was limiting the JScrollPanel width.

    I deleted the first JPanle and added those components to the mainPanel witht the JScrollPane below them. It now resizes correctly.

Similar Threads

  1. How to programmatically set combobox width?
    By stab in forum AWT / Java Swing
    Replies: 1
    Last Post: June 3rd, 2011, 04:59 PM
  2. JTable is not fit to the screen width.
    By rajakumarjk in forum AWT / Java Swing
    Replies: 2
    Last Post: October 12th, 2010, 11:13 AM
  3. How can I reduce network utilization?
    By Drakenmul in forum Java Networking
    Replies: 0
    Last Post: June 15th, 2010, 06:58 AM
  4. JButton Width & Height
    By Howdy_McGee in forum Java Theory & Questions
    Replies: 4
    Last Post: May 22nd, 2010, 08:12 AM
  5. Reading the size (height and width) of word documents
    By pradeep_das in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: May 7th, 2010, 10:58 AM