Community
Participate
Working Groups
package com.dnastar.common.ui.draw2d; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import org.eclipse.draw2d.GridData; import org.eclipse.draw2d.GridLayout; import org.eclipse.draw2d.LightweightSystem; import org.eclipse.draw2d.RectangleFigure; import org.eclipse.draw2d.ScrollBar; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class Bug extends Composite { private static final int VALUE = 0; private static final int EXTENT = 1; private static final int MIN = 0; private static final int MAX = 100; private ScrollBar m_scroll; public Bug(Composite parent, int style) { super(parent, style); setLayout(new FillLayout()); Canvas canvas = new Canvas(this, SWT.NONE); final LightweightSystem m_lws = new LightweightSystem(); m_lws.setControl(canvas); final RectangleFigure top = new RectangleFigure(); top.setLayoutManager(new GridLayout(2, false)); m_lws.setContents(top); m_scroll = new ScrollBar(); m_scroll.setHorizontal(true); m_scroll.setMaximum(MAX); m_scroll.setMinimum(MIN); m_scroll.setPageIncrement(1); m_scroll.setExtent(EXTENT); m_scroll.setValue(VALUE); top.add(m_scroll); top.setConstraint(m_scroll, new GridData(SWT.FILL, SWT.FILL, true, false)); m_scroll.getRangeModel().addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { m_scroll.invalidate(); m_lws.getUpdateManager().performUpdate(); } }); } public static void main(String[] args) { Display display = new Display (); Shell shell = new Shell (display); shell.setLayout (new FillLayout ()); new Bug(shell, SWT.NONE); shell.pack(); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }
This is very similar to bug 17760. If I repeatedly click around the thumb, I can get the scroll bar to scroll uncontrollably off to one side.