FigureCanvas scrollbars dont work [message #227108] |
Wed, 29 November 2006 04:56 |
Klaus Wuestefeld Messages: 3 Registered: July 2009 |
Junior Member |
|
|
Hi,
I am the author of the Byecycle plugin for eclipse.
http://byecycle.sourceforge.net/
I am having trouble getting scrollbars to work correctly. They just sit
there grayed-out and do nothing:
FigureCanvas canvas = new FigureCanvas(shell);
canvas.setScrollBarVisibility(FigureCanvas.ALWAYS);
IFigure figure = new Figure();
XYLayout layout = new XYLayout();
figure.setLayoutManager(layout);
Label label = new Label("Banana");
figure.add(label);
label.setSize(label.getPreferredSize());
label.setLocation(new Point(30, 30));
canvas.setContents(figure);
You can run the example below to see what I mean. I am using
org.eclipse.draw2d_3.2.1.v20060921.jar but I get the same problem on
draw2d jars since 2005.
Could somebody please help me?
Thanks, Klaus.
-------------------------------------------------
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class ScrollbarTest {
public static void main(String args[]) {
new ScrollbarTest();
}
private final Display _display = new Display();
private ScrollbarTest() {
Shell shell = new Shell(_display);
shell.setText("Scrollbar Test");
shell.setSize(300, 300);
shell.setLayout(new FillLayout());
FigureCanvas canvas = new FigureCanvas(shell);
canvas.setScrollBarVisibility(FigureCanvas.ALWAYS);
IFigure figure = new Figure();
XYLayout layout = new XYLayout();
figure.setLayoutManager(layout);
Label label = new Label("Banana");
figure.add(label);
label.setSize(label.getPreferredSize());
label.setLocation(new Point(30, 30));
canvas.setContents(figure);
shell.open();
shell.layout();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {}
while (!shell.isDisposed()) {
while (!_display.readAndDispatch()) {
}
}
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.02029 seconds