How to add a Button-s in SWT?

Posted by Krausz Lóránt Szilveszter on Stack Overflow See other posts from Stack Overflow or by Krausz Lóránt Szilveszter
Published on 2014-05-28T21:23:40Z Indexed on 2014/05/28 21:25 UTC
Read the original article Hit count: 258

Filed under:

Only one "frame" is displayed in the left corner ,but I want a n*n buttons in display . I'd like to create a table using SWT, the table will include a column with button(s).

private void createButtonPanel() {

    GridData gridData = new GridData();

    gridData.heightHint = N * imageSize;

    gridData.widthHint = N * imageSize;

    Composite buttonPanel = new Composite(shell, SWT.NONE);
    buttonPanel.setBackground(new Color(display, 140, 140, 100));

    buttonPanel.setLayoutData(gridData);
    for (int i = 0; i < N; ++i) {
        for (int j = 0; i < N; ++i) {
            button[i][j] = new Button(buttonPanel, SWT.PUSH);
            button[i][j].setSize(imageSize, imageSize);

            button[i][j].setImage(null);

        }
   }

}

If some one know please help me...

© Stack Overflow or respective owner

Related posts about swt