Brendan, I think this is your problem. > rightScrollPane.add(commentPane);
Try replacing it with rightScrollPane.setView(commentPane); Some background if you are interested ... ScrollPane is an instance of ViewPort, which is in turn an instance of Container. http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ScrollPane.html http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Viewport.html http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Container.html Some Containers (like BoxPane) simply display whatever child Components were added to the Sequence<Component> that Container provides. http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/BoxPane.html http://pivot.apache.org/2.0/docs/api/org/apache/pivot/collections/Sequence.html Others Containers (like ScrollPane) are a little more complex and can display additional UI elements. In the case of ScrollPane, it can display a 'rowHeader', 'columnHeader', and 'corner' as well as a 'view'. http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ScrollPane.html#setRowHeader(org.apache.pivot.wtk.Component) http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ScrollPane.html#setColumnHeader(org.apache.pivot.wtk.Component) http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ScrollPane.html#setCorner(org.apache.pivot.wtk.Component) http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Viewport.html#setView(org.apache.pivot.wtk.Component) ScrollPane therefore needs to manage the Sequence<Component> provided by Container, so you need to tell it what to do with the Components that you give to it, rather than adding them to the Sequence<Component> directly (which is what rightScrollPane.add(commentPane) looks to be doing). In your example you want to show your 'rightScrollPane' Component as the ScrollPane's 'view'. 'view' is the default property of ScrollPane (inherited from ViewPort). This is defined via the @DefaultProperty annotation. http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/Viewport.java Unfortunately, the DefaultProperty annotation is not shown in the Pivot 2.0 Javadocs, but it is always visible in the source code. From 2.0.1 (which will hopefully be released soon) the DefaultProperty annotation *will* be visible in the Javadocs. Chris 2011/9/17 Brendan cheng <[email protected]>: > Hi, > I must say I'm totally new to Pivot. I'm trying add a box pane to my > window's scroll pane but even the code compiled properly, the box pane just > doesn't show up. > Here is the snippet from my main program. > > @Override > > public void startup(Display display, Map<String, String> properties) > throws Exception { > > String language = properties.get(LANGUAGE_KEY); > > Locale locale = (language == null) ? Locale.getDefault() : new > Locale(language); > > Resources resources = new Resources(ClientWindow.class.getName(), > locale); > > BXMLSerializer bxmlSerializer = new BXMLSerializer(); > > window = > (ClientWindow)bxmlSerializer.readObject(getClass().getResource("client_window.bxml"), > > resources); > > ScrollPane rightScrollPane = (ScrollPane) > bxmlSerializer.getNamespace().get("rightScrollPane"); > > BoxPane commentPane = null; > > try { > > commentPane = > (CommentPane)bxmlSerializer.readObject(getClass().getResource("thumbnail/comment_pane.bxml"), > > resources); > > } catch (IOException e) { > > e.printStackTrace(); > > } catch (SerializationException e) { > > e.printStackTrace(); > > } > > rightScrollPane.add(commentPane); > > window.open(display);(display); > > What do you recommend to do this job in pivot? > > Thanks in advance! > > Brendan
