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 8472887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:11:57+00:00 2026-06-10T17:11:57+00:00

How can I add a combo box to a specific column in my table?

  • 0

How can I add a combo box to a specific column in my table?
I would like for my last column to have a combo box with 3 selections (Yes, No, Both).
I will include my table code, so you can better show me how and were the new code would go.

  //////////////////////////////////////////////////////////////////////////
//                         createTableViewer()                          //
//////////////////////////////////////////////////////////////////////////
private TableViewer createTableViewer(Composite parent) {
  viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
  createColumns(parent, viewer);
  Table table = viewer.getTable();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);

  // Layout the viewer
  GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
  viewer.setContentProvider(new ArrayContentProvider());
  viewer.setInput(AplotDataModel.getInstance().getArrayData());
  viewer.getControl().setLayoutData(gridData);
  return viewer;
}

//////////////////////////////////////////////////////////////////////////
//                         createColumns()                              //
//////////////////////////////////////////////////////////////////////////
private void createColumns(final Composite parent, final TableViewer viewer) {
  String[] titles = { "ItemId", "RevId", "PRL", "Dataset Name", "EC Markup" };
  int[] bounds = { 150, 150, 100, 150, 100 };

  TableViewerColumn col = createTableViewerColumn(titles[0], bounds[0], 0);
  col.setLabelProvider(new ColumnLabelProvider() {
     @Override
     public String getText(Object element) {
        AplotDatasetData item = (AplotDatasetData) element;
        return item.getDataset().toString();
     }
  });

  col = createTableViewerColumn(titles[1], bounds[1], 1);
  col.setLabelProvider(new ColumnLabelProvider() {
     @Override
     public String getText(Object element) {
        AplotDatasetData item = (AplotDatasetData) element;
        return item.getRev().toString();
     }
  });

  col = createTableViewerColumn(titles[2], bounds[2], 2);
  col.setLabelProvider(new ColumnLabelProvider() {
     @Override
     public String getText(Object element) {
        AplotDatasetData item = (AplotDatasetData) element;
        return item.getPRLValue();
     }
  });

  col = createTableViewerColumn(titles[3], bounds[3], 3);
  col.setLabelProvider(new ColumnLabelProvider() {
     @Override
     public String getText(Object element) {
        AplotDatasetData item = (AplotDatasetData) element;
        return item.getDatasetName();
     }
  });

  col = createTableViewerColumn(titles[4], bounds[4], 4);
  col.setLabelProvider(new ColumnLabelProvider() {
     @Override
     public String getText(Object element) {
        AplotDatasetData item = (AplotDatasetData) element;
        return item.getECMarkupValue();
     }
  });
}

//////////////////////////////////////////////////////////////////////////
//                       createTableViewerColumn()                      //
//////////////////////////////////////////////////////////////////////////
private TableViewerColumn createTableViewerColumn(String title, int bound, final int colNumber) {
  final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
  final TableColumn column = viewerColumn.getColumn();
  column.setText(title);
  column.setWidth(bound);
  column.setResizable(true);
  column.setMoveable(true);
  return viewerColumn;
}
  • 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-10T17:11:58+00:00Added an answer on June 10, 2026 at 5:11 pm

    There are good examples here and here.

    Both use ComboBoxViewerCellEditor within the EditingSupport to provide the Combobox as in-table-editing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a combo box as you can see in the code that takes
I can't access to combo box's value for using in GridView. GridView something like
I have a UI with a Combo box. The list of items, which can
i have this static code that will hide/show some combo box but what if
I can add and remove the last line in my dynamic form and calculate
Let's say you have a JPanel size 200 x 200, with a custom combo-box-type
I want to add simple list/combo box with action script 3 . but i
I am trying to add a drop down combo box with a drop down
how can I add a double click event to a control that doesn't have
I have a combo box defined as such <ComboBox Name=RoomDropDown Visibility={Binding Path=RoomDropDownVisible,Mode=OneWay,Converter={StaticResource BoolVisibilityConvertor}} ItemsSource={Binding

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.