ScrollPane question [message #215838] |
Wed, 10 May 2006 19:12 |
Eclipse User |
|
|
|
Originally posted by: bandrews.nospam_bphnx.com
Hi,
I am trying to create a Figure container that contains a header
label and then a scrolling Figure under that which children will be
added to. The EditPart code I have below works except it scrolls the
header label too, so when the scrollbar is moved to the bottom, the
header label is hidden. I can see why it happens this way. ( Because
label is added to the contents before being added to the scroller. ) I
just don't know how to fix it. If I set up the children with a structure
like this.
Figure main
Label nameLabel
ScrollPane scrollPane
Figure scrollerContents
This also doesn't work, even though to me it seems logical. Can anyone
provide some hints on how this is supposed to be setup?
protected IFigure createFigure()
{
final DLBase model = ( DLBase ) getModel();
final IFigure contents = new Figure();
contents.setLayoutManager(new XYLayout());
contents.setSize(model.getSize());
contents.setOpaque(true);
contents.setBackgroundColor(new Color(null,model.getColor()));
final Label label = createLabel(model);
contents.add(label);
setNameLabel(label);
contents.setConstraint(label,new Rectangle(
0,0,model.getSize().width,NAME_LABEL_HEIGHT));
final ScrollPane scroller = new ScrollPane();
scroller.setHorizontalScrollBarVisibility(ScrollPane.NEVER);
scroller.setVerticalScrollBarVisibility(ScrollPane.AUTOMATIC );
scroller.setBorder(new LineBorder(ColorConstants.black));
scroller.setContents(contents);
mainContents = contents;
return scroller;
}
many thanks,
B
|
|
|
Powered by
FUDForum. Page generated in 0.03367 seconds