Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Disappearing Buttons(Buttons no longer show up after change in layout)
Disappearing Buttons [message #635328] Tue, 26 October 2010 12:52 Go to next message
ouri.maler is currently offline ouri.malerFriend
Messages: 22
Registered: July 2010
Junior Member
I've recently been trying to reorganize a GUI to add in a dropdown menu. The relevant bit of code is as follows:


  VerificationModel model;
  Text console;
  Display display;
  Graph graph;

   display = new Display();
    final Shell shell = new Shell(display);
    RowLayout lineLayout = new RowLayout();
    lineLayout.wrap = true;
    lineLayout.pack = true;
    lineLayout.justify = false;
    lineLayout.type = SWT.HORIZONTAL;
    lineLayout.marginLeft = 5;
    lineLayout.marginTop = 5;
    lineLayout.marginRight = 5;
    lineLayout.marginBottom = 5;
    lineLayout.spacing = 10;

    RowLayout columnLayout = new RowLayout();
    columnLayout.wrap = true;
    columnLayout.pack = false;  
    columnLayout.justify = false; 
    columnLayout.type = SWT.VERTICAL;
    columnLayout.marginLeft = 5;
    columnLayout.marginTop = 5;
    columnLayout.marginRight = 5;
    columnLayout.marginBottom = 5;
    columnLayout.spacing = 5;
    
    final int graphWidth = 600;
    final int graphHeight = 800;
    final int buttonWidth = 200;
    final int buttonHeight = 100;
    final int consoleWidth = 400;
    final int consoleHeight = 400;

    /****************************************/
    shell.setLayout(lineLayout);
    final Composite composite = new Composite(shell, SWT.NONE);  //composite forms the left half of the GUI display
    composite.setLayout(columnLayout);
    final Composite selectables = new Composite(composite, SWT.NONE);
    selectables.setLayout(lineLayout);
    final Group buttons = new Group(selectables, SWT.NONE);
    buttons.setText("Deadlock Search Methods");  
    buttons.setLayoutData(new RowData((100 + buttonWidth), (100 + buttonHeight*2)));
    buttons.setLayout(columnLayout);
    /****************************************/

    Button button1 = new Button(buttons, SWT.PUSH);
    Button button2 = new Button(buttons, SWT.PUSH);
    button1.setLayoutData(new RowData(buttonWidth, buttonHeight));
    button2.setLayoutData(new RowData(buttonWidth, buttonHeight));

    console = new Text(composite, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
    console.setLayoutData(new RowData(consoleWidth, consoleHeight));

    Group diagram = new Group(shell, SWT.PUSH);
    diagram.setText("BIP model view");  
    diagram.setLayoutData(new RowData(graphWidth, graphHeight));
    diagram.setLayout(lineLayout);
    graph = new Graph(diagram, SWT.NONE);
    graph.setLayoutData(new RowData(graphWidth-10, graphHeight-10));
    graph.setLayoutAlgorithm(new SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);
    graph.applyLayout();

    shell.pack(); //reduce size to minimum required for all widgets
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();


For some reason, the buttons don't appear. I don't encounter that problem when I replace the relevant code with this:

 shell.setLayout(lineLayout);
    final Composite composite = new Composite(shell, SWT.NONE);  //composite forms the left half of the GUI display
    composite.setLayout(columnLayout);
    //final Composite selectables = new Composite(composite, SWT.NONE);
    //selectables.setLayout(lineLayout);
    final Group buttons = new Group(composite, SWT.NONE);
    //final Group buttons = new Group(selectables, SWT.NONE);
    buttons.setText("Deadlock Search Methods");  
    buttons.setLayoutData(new RowData((100 + buttonWidth), (100 + buttonHeight*2)));
    buttons.setLayout(columnLayout);

[Updated on: Tue, 26 October 2010 12:54]

Report message to a moderator

Re: Disappearing Buttons [message #639882 is a reply to message #635328] Thu, 18 November 2010 09:12 Go to previous message
ouri.maler is currently offline ouri.malerFriend
Messages: 22
Registered: July 2010
Junior Member
I'm not entirely certain why, but the problem seemed to go away once I removed the shell.setLayout(lineLayout); line.
Previous Topic:create complex linestyles for connections
Next Topic:Using more than one foregroundcolor in figure?
Goto Forum:
  


Current Time: Thu Apr 25 08:52:20 GMT 2024

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

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

Back to the top