Skip to main content
Jump to: navigation, search

Difference between revisions of "Nebula Launcher"

m
m
 
Line 17: Line 17:
 
* A method to get the selected item : <code>int getSelection()</code>
 
* A method to get the selected item : <code>int getSelection()</code>
  
<code>
+
 
<nowiki>
+
 
  final Launcher l = new Launcher(shell, SWT.NONE);
 
  final Launcher l = new Launcher(shell, SWT.NONE);
 
  l.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
 
  l.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
Line 25: Line 24:
 
  l.addItem("Presentation", "org/mihalis/opal/launcher/icons/x-office-presentation.png");
 
  l.addItem("Presentation", "org/mihalis/opal/launcher/icons/x-office-presentation.png");
 
  l.addItem("Spreadsheet", "org/mihalis/opal/launcher/icons/x-office-spreadsheet.png");
 
  l.addItem("Spreadsheet", "org/mihalis/opal/launcher/icons/x-office-spreadsheet.png");
 +
 +
l.addSelectionListener(new SelectionAdapter() {
 +
      @Override
 +
      public void widgetSelected(final SelectionEvent e) {
 +
          Dialog.inform("Selection", "You have selected item #" + l.getSelection());
 +
      }
 +
});
  
l.addSelectionListener(new SelectionAdapter() {
 
 
/**
 
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
 
*/
 
@Override
 
public void widgetSelected(final SelectionEvent e) {
 
Dialog.inform("Selection", "You have selected item #" + l.getSelection());
 
}
 
 
});
 
</nowiki></code>
 
  
 
=Example=
 
=Example=

Latest revision as of 06:42, 19 March 2020

< Back to Nebula Main Page

Introduction

Launcher.png

A widget used to launch applications, modules or anything, with a simple and fancy zoom effect, widely inspired by work of Romain Guy.

Usage

This launcher contains 4 methods :

  • 2 methods to add and remove selection listeners (addSelectionListener and removeSelectionListener)
  • One method to add and item : void addItem(final String title, final String image) where title is the text located under the image
  • A method to get the selected item : int getSelection()


final Launcher l = new Launcher(shell, SWT.NONE);
l.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
l.addItem("Address Book", "org/mihalis/opal/launcher/icons/x-office-address-book.png");
l.addItem("Calendar", "org/mihalis/opal/launcher/icons/x-office-calendar.png");
l.addItem("Presentation", "org/mihalis/opal/launcher/icons/x-office-presentation.png");
l.addItem("Spreadsheet", "org/mihalis/opal/launcher/icons/x-office-spreadsheet.png");

l.addSelectionListener(new SelectionAdapter() {
     @Override
     public void widgetSelected(final SelectionEvent e) {
          Dialog.inform("Selection", "You have selected item #" + l.getSelection());
     }
});


Example

A example called LauncherSnippet is located in the plugin org.eclipse.nebula.widgets.opal.launcher.snippets.

This example is also available here : LauncherSnippet

Back to the top