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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:26:36+00:00 2026-06-08T08:26:36+00:00

I have created two expand bars under TabFolder in SWT. And I set the

  • 0

I have created two expand bars under TabFolder in SWT. And I set the layout for the tab foloder as FillLayout(SWT.HORIZONTAL). It is showing two expand bars in the tabfolder.
But when I changed the tab folder into CTabFolder with the same layout it does not show me
any expandbars under the CTabFolder. What could be the issue? Do I need to set any parameter for that? Please see my below code for TabFolder and CTabFolder.

Code for TabFolder:

public class Snippet223 {

    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new FillLayout());
        shell.setText("ExpandBar Example");
        final TabFolder folder = new TabFolder(shell, SWT.BORDER);
        folder.setLayout(new FillLayout(SWT.HORIZONTAL));
        ExpandBar bar = new ExpandBar(folder, SWT.V_SCROLL);
        ExpandBar bar1 = new ExpandBar(folder, SWT.V_SCROLL);
        Image image = display.getSystemImage(SWT.ICON_QUESTION);
        // First item
        createContentsForExpandableBar(bar, image);
        createContentsForExpandableBar(bar1, image);
        shell.setSize(400, 350);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
    }

    private static void createContentsForExpandableBar(ExpandBar bar,
            Image image) {
        Composite composite = new Composite(bar, SWT.NONE);
        GridLayout layout = new GridLayout();
        layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
        layout.verticalSpacing = 10;
        composite.setLayout(layout);
        Button button = new Button(composite, SWT.PUSH);
        button.setText("SWT.PUSH");
        button = new Button(composite, SWT.RADIO);
        button.setText("SWT.RADIO");
        button = new Button(composite, SWT.CHECK);
        button.setText("SWT.CHECK");
        button = new Button(composite, SWT.TOGGLE);
        button.setText("SWT.TOGGLE");
        ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
        item0.setText("What is your favorite button");
        item0.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
        item0.setControl(composite);
        item0.setImage(image);
    }

}

Code for CTabFolder:

public class Snippet223 {

    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new FillLayout());
        shell.setText("ExpandBar Example");
        final CTabFolder folder = new CTabFolder(shell, SWT.BORDER);
        folder.setLayout(new FillLayout(SWT.HORIZONTAL));
        ExpandBar bar = new ExpandBar(folder, SWT.V_SCROLL);
        ExpandBar bar1 = new ExpandBar(folder, SWT.V_SCROLL);
        Image image = display.getSystemImage(SWT.ICON_QUESTION);
        // First item
        createContentsForExpandableBar(bar, image);
        createContentsForExpandableBar(bar1, image);
        shell.setSize(400, 350);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
    }

    private static void createContentsForExpandableBar(ExpandBar bar,
            Image image) {
        Composite composite = new Composite(bar, SWT.NONE);
        GridLayout layout = new GridLayout();
        layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
        layout.verticalSpacing = 10;
        composite.setLayout(layout);
        Button button = new Button(composite, SWT.PUSH);
        button.setText("SWT.PUSH");
        button = new Button(composite, SWT.RADIO);
        button.setText("SWT.RADIO");
        button = new Button(composite, SWT.CHECK);
        button.setText("SWT.CHECK");
        button = new Button(composite, SWT.TOGGLE);
        button.setText("SWT.TOGGLE");
        ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
        item0.setText("What is your favorite button");
        item0.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
        item0.setControl(composite);
        item0.setImage(image);
    }

}
  • 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-08T08:26:38+00:00Added an answer on June 8, 2026 at 8:26 am

    You’ll need to create a TabItem/CTabItem under the TabFolder/CTabFolder and add the content to that. You shouldn’t be setting a layout on the tab folder itself. From the JavaDoc for CTabFolder:

    Note that although this class is a subclass of Composite,
    it does not make sense to set a layout on it.

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

Sidebar

Related Questions

I have created two folders layout and layout-land with two xml files, one for
I have two-column layout with a header and footer. I have created a JSFilddle
I have created two imageViews promatically as shown below: public void createImageViews(Integer count){ ImageView[]
I have created two WindowSurface (WPF), and I want to navigate betwen them. I've
I have created two tables & inserted values as shown below . Table 1
I have created two Pages Page1.xaml and Page2.xaml in windows8 metro apps. I have
I have created two DbContexts, one is for application configuration, the second is for
I have created two forms in my Windows Application. One Form acts as a
I have created two files: tunables.h #ifndef TUNABLES_H #define TUNABLES_H void tunables_load_conservative(); void tunables_load_aggressive();
I have created two JavaScript files. One file is "validators.js" and the other is

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.