Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8697595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:33:55+00:00 2026-06-13T01:33:55+00:00

I just created a new class that extends TitleAreaDialog . I overrode the method

  • 0

I just created a new class that extends TitleAreaDialog.

I overrode the method createButtonsForButtonBar and I was able to add new buttons. But placing one on the LEFT?? (Default is the right, besids OK and CANCEL).

Thanks very much!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:33:56+00:00Added an answer on June 13, 2026 at 1:33 am

    In this case, don’t override createButtonsForButtonBar, that will have already set up the GridLayout such that the buttons are on the right side. Instead, override createButtonBar, which will let you have control over the entire composite there.

    It’s easy to add something to the left side and then let SWT place the OK / Cancel buttons for you – which I recommend, since you would otherwise have to duplicate the logic of where the “default” button gets placed (far-right on Mac OS and recent GNOME, to the left of the Cancel button on Win32 and older GNOME.) In this case, you can set up a composite that spans the entirety of the button bar and then let SWT draw its button bar in the far right.

    For example:

    @Override
    protected Control createButtonBar(final Composite parent)
    {
        final Composite buttonBar = new Composite(parent, SWT.NONE);
    
        final GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.makeColumnsEqualWidth = false;
        layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
        buttonBar.setLayout(layout);
    
        final GridData data = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
        data.grabExcessHorizontalSpace = true;
        data.grabExcessVerticalSpace = false;
        buttonBar.setLayoutData(data);
    
        buttonBar.setFont(parent.getFont());
    
        // place a button on the left
        final Button leftButton = new Button(buttonBar, SWT.PUSH);
        leftButton.setText("Left!");
    
        final GridData leftButtonData = new GridData(SWT.LEFT, SWT.CENTER, true, true);
        leftButtonData.grabExcessHorizontalSpace = true;
        leftButtonData.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        leftButton.setLayoutData(leftButtonData);
    
        // add the dialog's button bar to the right
        final Control buttonControl = super.createButtonBar(buttonBar);
        buttonControl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
    
        return buttonBar;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a class that extends DbConnection in a brand new project. public class
so I just created a new app that is references an older app of
I've just started to extend the MySQLi class and found that member variables created
I just created a new table and filled it with data. When I run
I just created a new rails app in Rails 3.1.1, and my application layout
I just created a new project using the visual studio cordova starter template. However
I've just created a new Virtual Machine, which was initially completely clean - I've
I have just created a new project with a many-to-many relation (User-Group) and the
I've just created a new MySQL user with a password and granted them all
I've just created a new view based application, and now I want to set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.