Adding a component to a scroll pane

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

Adding a component to a scroll pane

Postby fredatwork » Wed Sep 22, 2004 6:57 am

Hello,

When you add a component to a scroll pane, using the mouse and pointing on a parent scroll pane in the hierarchical bean view, the viewport is not automatically updated. You have to set manually the viewport view.

This is quite confusing, especailly when comparing with other GUI builders.

I would suggest the viewport view property of a scroll pane being automatically initialized when a component is added to a scrollpane.

Cheers,

Fred
Fred
fredatwork
 
Posts: 13
Joined: Mon Sep 20, 2004 1:59 pm
Location: France

Re: Adding a component to a scroll pane

Postby Eric Clayberg » Wed Sep 22, 2004 8:37 am

fredatwork wrote:I would suggest the viewport view property of a scroll pane being automatically initialized when a component is added to a scrollpane.

Designer does do this, but you need to drop the component on the scroll pane in the design view rather than the widget tree.

Then it creates code like...

Code: Select all
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(35, 35, 340, 235);
getContentPane().add(scrollPane);

JPanel panel = new JPanel();
scrollPane.setViewportView(panel);
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby fredatwork » Wed Sep 22, 2004 3:56 pm

My point was that the Designer should set the viewport in both circumstances:
a. if the component is dropped on the scollpane inside the design view
b. if the component is added to the hierarchical bean tree.

I also suggest a possible improvment for a future release.

Fred
Fred
fredatwork
 
Posts: 13
Joined: Mon Sep 20, 2004 1:59 pm
Location: France

Postby Eric Clayberg » Thu Sep 23, 2004 8:42 am

fredatwork wrote:My point was that the Designer should set the viewport in both circumstances:
a. if the component is dropped on the scollpane inside the design view
b. if the component is added to the hierarchical bean tree.
I also suggest a possible improvment for a future release.

This is now available in the latest v2.1.1 build.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Swing Designer

Who is online

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