Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe you are looking for below method on <code>ScrolledComposite</code></p> <pre><code> org.eclipse.swt.custom.ScrolledComposite.showControl(Control) //make it visible in view port org.eclipse.swt.custom.ScrolledComposite.setOrigin(Point) //sets left corner coordinates, read SWT docs </code></pre> <p>Updated Answer:</p> <pre><code>public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Map&lt;String,Control&gt; controlMap = new HashMap&lt;String,Control&gt;(); final ScrolledComposite scrollComposite = new ScrolledComposite(shell, SWT.V_SCROLL | SWT.BORDER); final Composite parent = new Composite(scrollComposite, SWT.NONE); for (int i = 0; i &lt;= 50; i++) { Label label = new Label(parent, SWT.NONE); String index = String.valueOf(i); controlMap.put(index, label); label.setText(index); } GridLayoutFactory.fillDefaults().numColumns(1).applyTo(parent); scrollComposite.setContent(parent); scrollComposite.setExpandVertical(true); scrollComposite.setExpandHorizontal(true); scrollComposite.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { Rectangle r = scrollComposite.getClientArea(); scrollComposite.setMinSize(parent.computeSize(r.width, SWT.DEFAULT)); } }); shell.open(); Control showCntrl = controlMap.get(String.valueOf(5)); if(showCntrl != null){ scrollComposite.setOrigin(showCntrl.getLocation()); } while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload