scrollpane and vieportview

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

scrollpane and vieportview

Postby mkornatzki » Wed Feb 18, 2009 4:30 am

i' m not sure. either i don't understand what's happening or there is a bug.
to make it easy i have a jframe, a scrollpane and a panel.
i add the scrollpane and the panel to the jframe.
now i set in the properties editor for the scrollpane the viewportView to the panel.
In the designer nothing happens but the source gets changed like this :shock: :

protected JPanel getPanel() {
if (panel == null) {
panel = new JPanel();

What i expected is something like this:
protected JScrollPane getScrollPane() {
if (scrollPane == null) {

return scrollPane;

Do i handle the designer in a wrong way?
Posts: 121
Joined: Wed Oct 15, 2008 3:57 am

Re: scrollpane and vieportview

Postby Konstantin.Scheglov » Wed Feb 18, 2009 10:30 am

1. In general you should not select view port using "viewportView" property. You should just drop it on JScrollPane on design canvas.

2. When JScrollPane is also created using getX() method, I can successfully select "panel" as "viewportView" value.

So, in general answer is "don't do this." ;-)
Posts: 186
Joined: Tue Oct 18, 2005 8:11 pm
Location: Russian Federation, Lipetsk

Return to Swing Designer

Who is online

Users browsing this forum: Google [Bot] and 1 guest