JScrollPane content sizing



Hi,

I'm new to Java GUI programming, and it's been a constant struggle
to write a GUI that looks like it was on purpose. Well, JScrollPane
has been giving me more trouble than it's worth, so as a last resort,
maybe someone could just tell me how to fix it?..

What I want to do is have a JScrollPane containing a JPanel. The
JPanel should automatically size to the width of the JScrollPane's
viewport, and to the minimum height of the contents of the JPanel. The
idea being that the JPanel's controls spring to fit the width of the
JScrollPane, (never showing a horizontal scroll bar), but be compact
vertically, showing a vertical scrollbar when the JScrollPane is too
small.

Hope that makes some sense; any help greatly appreciated

Thank you,
Kind regards,
Eliott
.



Relevant Pages

  • Re: JScrollPane content sizing
    ... I'm new to Java GUI programming, and it's been a constant struggle ... What I want to do is have a JScrollPane containing a JPanel. ... JPanel should automatically size to the width of the JScrollPane's ... The JScrollPane only shows vertical scroll bars, ...
    (comp.lang.java.gui)
  • =?iso-8859-1?q?Re:_JPanel_l=E4uft_=FCber_JScrollPane_-_kein_scrollen?=
    ... public class Fehler extends JFrame implements ActionListener, ... private JPanel jp_Rechts2 = new JPanel; ... private JScrollPane jscrollpaneL = new JScrollPane; ... Next by Date: ...
    (de.comp.lang.java)
  • Re: Problem mit JScrollPane und einem Bild in JTabbedPane
    ... > Ich versuche momentan in einem JTabbedPane ein Bild mit JScrollPane zu ... > private JPanel plInfo = new JPanel; ...
    (de.comp.lang.java)
  • Layout Problem mit 2 JScrollPanes nebeneinander
    ... ich schlage mich jetzt seit etwa 2 Abenden mit einem Problem bei der Darstellung von 2 JScrollPane herum, ... TestDialog1 dlg = new TestDialog1; ... JPanel actions = new JPanel; ... Component comp = super.getListCellRendererComponent; ...
    (de.comp.lang.java)
  • JScrollPane doesnt scroll a JPanel?
    ... I've never had problems with JScrollPane like I'm running into here... ... I am trying to create a Swing UI for VNC, ... JPanel. ... The inner JPanel implements getPreferredSize, ...
    (comp.lang.java.gui)