Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] How to right align the buttons created in createButtonsForButtonB ar()?

Title: How to right align the buttons created in createButtonsForButtonBar()?

I have a subclass of org.eclipse.jface.dialogs.Dialog, in which I overwrite the createButtonsForButtonBar() method to create my own buttons. For some reason, the buttons are left aligned, but I want them to be right aligned. Here is a code snippet.

        protected void createButtonsForButtonBar(Composite parent)
        {
                Button button1 = createButton(parent, 1, "Button1", true);
                Button button2 = createButton(parent, 2, "Button2", false);
        }

Since it doesn't work as I expected, I add a little more to change the parent's grid data like this before buttons are created.


                GridData pGridData = (GridData) parent.getLayoutData();
                pGridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END;
                parent.setLayoutData(pGridData);

Still the same. Could anyone help? Thanks!


Back to the top