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

  • Home
  • SEARCH
  • 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 9019951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:53:30+00:00 2026-06-16T04:53:30+00:00

This should be pretty simple but this is the first time I’ve worked with

  • 0

This should be pretty simple but this is the first time I’ve worked with SWT. This is what I have so far.

public class TabsTest {

private Shell shell;
private CTabFolder folder;

public TabsTest(Display display){

    shell = new Shell(display);
    shell.setText("TabsTest");
    shell.setLayout(new FillLayout());

    CTabFolder folder = new CTabFolder(shell, SWT.CLOSE | SWT.BOTTOM);
    folder.setUnselectedCloseVisible(false);
    folder.setSimple(false);

    initUI(folder);

    shell.pack();
    shell.setBounds(500, 500, 400, 500);
    shell.open ();

    while(!shell.isDisposed()){
        if(!display.readAndDispatch())
            display.sleep();
    }   
}

public void initUI(CTabFolder folder){
    CTabItem NFL = new CTabItem(folder, SWT.NONE);
    NFL.setText("NFL Bets");

    Button okButton = new Button(folder, SWT.PUSH);
    okButton.setText("OK");
    okButton.setSize(10,10);

    NFL.setControl(okButton);

    CTabItem NBA = new CTabItem(folder,SWT.NONE);
    NBA.setText("NBA Bets");

    CTabItem CFB = new CTabItem(folder,SWT.NONE);
    CFB.setText("CFB Bets");        

    folder.setSize(800,500);

}

public static void main (String [] args) {
    Display display = new Display();
    new TabsTest(display);
    display.dispose();
}

}

What this currently gives me is this….

picture

How would I make this a small button in the bottom right corner? Or just in general make it smaller and move it somewhere.

  • 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-16T04:53:31+00:00Added an answer on June 16, 2026 at 4:53 am

    Since you are using a FillLayout the control takes up the entire space available. What you need is a different kind of a layout. I will suggest you to read this article, it will be a good start.

    I generally prefer GridLayout as it is quite easy to use and it fulfills most needs.

    Edited: Modifying your code to use GridLayout

    public class TabsTest {
    
        private Shell shell;
        private CTabFolder folder;
    
        public TabsTest(Display display) {
            shell = new Shell(display);
            shell.setText("TabsTest");
            shell.setLayout(new GridLayout());
    
            CTabFolder folder = new CTabFolder(shell, SWT.CLOSE | SWT.BOTTOM);
            folder.setUnselectedCloseVisible(false);
            folder.setSimple(false);
            folder.setLayoutData(new GridData(GridData.FILL_BOTH));
    
            initUI(folder);
    
            shell.pack();
            shell.setBounds(500, 500, 400, 500);
            shell.open();
    
            while (!shell.isDisposed()) {
                if (!display.readAndDispatch())
                    display.sleep();
            }
        }
    
        public void initUI(CTabFolder folder) {
            CTabItem NFL = new CTabItem(folder, SWT.NONE);
            NFL.setText("NFL Bets");
    
            Composite nflParent = new Composite(folder, SWT.NONE);
            nflParent.setBackground(folder.getDisplay().getSystemColor(SWT.COLOR_BLUE));
            nflParent.setLayout(new GridLayout());
    
            Button okButton = new Button(nflParent, SWT.PUSH);
            okButton.setText("OK");
    
            GridData gd = new GridData();
            gd.verticalAlignment = GridData.END;
            gd.horizontalAlignment = GridData.END;
            gd.grabExcessHorizontalSpace = true;
            gd.grabExcessVerticalSpace = true;
            okButton.setLayoutData(gd);
    
            NFL.setControl(nflParent);
    
            CTabItem NBA = new CTabItem(folder, SWT.NONE);
            NBA.setText("NBA Bets");
    
            CTabItem CFB = new CTabItem(folder, SWT.NONE);
            CFB.setText("CFB Bets");
    
            folder.setSize(800, 500);
        }
    
        public static void main(String[] args) {
            Display display = new Display();
            new TabsTest(display);
            display.dispose();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be pretty simple, but I am new at LINQ. I have a
This feels like it should be pretty simple, but not much seems to be
This should be simple, but I'm getting confused. I have a parent/child tables -
I have been struggling with a problem that should be pretty simple actually but
So this should be pretty simple, but I can't seem to find my fail
This SHOULD be pretty simple, but day 2 I cannot figure it out. I
This should be pretty simple, still I can not see what/how something could be
This should be pretty straightforward I would think. I have this string: [quote=Joe Johnson|1]Hi![/quote]
This should be a pretty straightforward question. I have the following code, which forms
This seems like it should be pretty straight forward, but I'm apparently confused. I

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.