Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Scroll Pane does not work with shell menu
Scroll Pane does not work with shell menu [message #722478] Mon, 05 September 2011 22:50 Go to next message
rahulrevo is currently offline rahulrevoFriend
Messages: 2
Registered: September 2011
Junior Member

I have a simple class below where a shell with a menu bar is created and it contains a ScrollPane. The scroll pane content figure contains many rectangle figures which should cause the horizontal and vertical scroll bar to appear in the scroll pane. However the horizontal scroll bar does not appear when shell has a menu. If shell menu is not attached (comment buildMenu(shell) ) then both the horizontal and vertical scroll bars appear.

Anyone has any ideas on how this can be fixed?


import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.GridLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LightweightSystem;
import org.eclipse.draw2d.RectangleFigure;
import org.eclipse.draw2d.ScrollPane;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;

public class ScrollPaneTest {

  private static final int COLUMN_COUNT = 50;
  private static final int FIGURE_COUNT = 500;

  public static void main(String args[]) {
    new ScrollPaneTest().process();

  public void process() {
    Display d = Display.getDefault();
    final Shell shell = new Shell(d);

    // Comment this line for the scroll bars

    LightweightSystem lws = new LightweightSystem(shell);

    final ScrollPane scrollPane = new ScrollPane();

    final Figure contents = new Figure();
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = COLUMN_COUNT;

    for (int i = 0; i < FIGURE_COUNT; i++) {
      IFigure rectangleFigure = createFigure();
    Display display = Display.getDefault();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())

  IFigure createFigure() {
    RectangleFigure rectangleFigure = new RectangleFigure();
    rectangleFigure.setSize(300, 300);
    return rectangleFigure;

  private void buildMenu(final Shell shell) {
    Menu menuBar = new Menu(shell, SWT.BAR);

    MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
    Menu fileSubmenu = new Menu(shell, SWT.DROP_DOWN);

    MenuItem exitMenuItem = new MenuItem(fileSubmenu, SWT.PUSH);
    exitMenuItem.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {

Re: Scroll Pane does not work with shell menu [message #722485 is a reply to message #722478] Mon, 05 September 2011 23:20 Go to previous message
rahulrevo is currently offline rahulrevoFriend
Messages: 2
Registered: September 2011
Junior Member
This bug showed up on a Linux 64 bit OS (Ubuntu) and was not reproducible on Windows 32bit
Previous Topic:connection feedbacks
Next Topic:Creating collapsable and expandable figures
Goto Forum:

Current Time: Fri Dec 03 08:23:23 GMT 2021

Powered by FUDForum. Page generated in 0.02179 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top