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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:21:16+00:00 2026-05-23T05:21:16+00:00

I want to show a popup menu below a toolbar button when the user

  • 0

I want to show a popup menu below a toolbar button when the user clicks this button. I’ve read about the SWT.DROP_DOWN style for a ToolItem but this seems very much limited to a simple list of items according to this sample. Instead, I want to show a popup menu with, e.g., checkbox and radio button menu items.

  • 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-05-23T05:21:17+00:00Added an answer on May 23, 2026 at 5:21 am

    You can make MenuItem with styles SWT.CHECK, SWT.CASCADE, SWT.PUSH, SWT.RADIO, SWT.SEPARATOR
    see javadoc..

    So you can “hang” swt menu to selection of dropdown on toolbar item like this

    public class Test {
    
    private Shell shell;
    
    public Test() {
        Display display = new Display();
        shell = new Shell(display, SWT.SHELL_TRIM);
        shell.setLayout(new FillLayout(SWT.VERTICAL));
        shell.setSize(50, 100);
    
        ToolBar toolbar = new ToolBar(shell, SWT.FLAT);
        ToolItem itemDrop = new ToolItem(toolbar, SWT.DROP_DOWN);
        itemDrop.setText("drop menu");
    
        itemDrop.addSelectionListener(new SelectionAdapter() {
    
            Menu dropMenu = null;
    
            @Override
            public void widgetSelected(SelectionEvent e) {
                if(dropMenu == null) {
                    dropMenu = new Menu(shell, SWT.POP_UP);
                    shell.setMenu(dropMenu);
                    MenuItem itemCheck = new MenuItem(dropMenu, SWT.CHECK);
                    itemCheck.setText("checkbox");
                    MenuItem itemRadio = new MenuItem(dropMenu, SWT.RADIO);
                    itemRadio.setText("radio1");
                    MenuItem itemRadio2 = new MenuItem(dropMenu, SWT.RADIO);
                    itemRadio2.setText("radio2");
                }
    
                if (e.detail == SWT.ARROW) {
                    // Position the menu below and vertically aligned with the the drop down tool button.
                    final ToolItem toolItem = (ToolItem) e.widget;
                    final ToolBar  toolBar = toolItem.getParent();
    
                    Point point = toolBar.toDisplay(new Point(e.x, e.y));
                    dropMenu.setLocation(point.x, point.y);
                    dropMenu.setVisible(true);
                } 
    
            }
    
        });
    
        shell.open();
    
        while(!shell.isDisposed()) {
            if(!display.readAndDispatch()) display.sleep();
        }
    
        display.dispose();
    }
    
    public static void main(String[] args) {
        new Test();
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I work on Asp.Net VS08 C#. Clicking on Button want to show popup. popup
I want to show a popup on click of a button. I am able
Hi i want my java program to show a popup and gain read,write,delete file,folder
I want to show a modal popup when a user click on an asp
I want to show a popup about browser compatibility to the users visiting my
I want to show Popup window contain YouTube video. My question is how to
I need a jquery slideshow with div popup i want to show my image
I want to create a simple multiline Alert popup Alert.show(Blah\\nBlah) shows Blah\nBlah when what
I want to show a modal dialog/pop-up window when the user has not filled
I want to show a chromeless modal window with a close button in the

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.