GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Log in
  • Manage Cookies
  • Download
  • Projects
  • Working Groups
  • Members
  • Marketplace
  • Events
  • Planet Eclipse
  • Newsletter
  • Videos
  • Blogs
  • Report a Bug
  • Forums

This view

  • Original page
  • New address

GeezerVison is showing wiki.eclipse.org — Nebula NebulaSplitButton - Eclipsepedia

Jump to: navigation, search

Nebula NebulaSplitButton

< Back to Nebula Main Page

Introduction

SplitButton.png

This widget is a Push or Toogle Button with and attached menu. When the user clicks on the left part of the button, the action (push or toggle) is performed. Otherwise, a menu is displayed

Contents

  • 1 Introduction
  • 2 Usage
  • 3 Examples

Usage

There is three steps : First, you instantiate a SplitButton object :

final SplitButton actionButton = new SplitButton(shell, SWT.NONE);

The style can be SWT.NONE or SWT.PUSH to create an instance of a Push button, or SWT.TOGGLE for a Toggle button.

Then you get the menu associated to this button :

 final Menu actionMenu = actionButton.getMenu();

And you add the items associated to this menu :

 final MenuItem item = new MenuItem(actionMenu, SWT.PUSH);
 item.setText("First menu item");
 item.addListener(SWT.Selection, e -> System.out.println("Click on menu item 'First menu item'"));

And voilà, it is done !

The SplitButton API mimics the Button API. You can add selection listeners, change button state...

Examples

An example called SplitButtonSnippet.java is located in the plugin org.eclipse.nebula.widgets.splitbutton.snippets.

This example is also available here : SplitButtonSnippet.java

Retrieved from "https://wiki.eclipse.org/index.php?title=Nebula_NebulaSplitButton&oldid=438774"

This page was last modified 06:55, 19 March 2020 by Eclipsepedia anonymous user Unnamed Poltroon.

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.