Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Nebula NebulaSlider"

(Created page with "< Back to Nebula Main Page =Introduction= File:Nebulaslider.png __TOC__ This widget is an other visualisation of a Slider. It represents an integer value w...")
 
m
 
Line 8: Line 8:
 
__TOC__
 
__TOC__
  
This widget is an other visualisation of a Slider. It represents an integer value which is in a range of data.
+
This widget is an other visualisation of a <code>Slider</code>. It represents an integer value which is in a range of data.
  
 
'''Important:''' This widget is currently horizontal. If you need a vertical slider, please fill a bug with [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Nebula Bugzilla]
 
'''Important:''' This widget is currently horizontal. If you need a vertical slider, please fill a bug with [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Nebula Bugzilla]
Line 16: Line 16:
 
The usage is very simple :
 
The usage is very simple :
 
* You create a NebulaSlider widget
 
* You create a NebulaSlider widget
* You set the minimum value, the maximum value and the value with the appropriate setters ('''setMinimum()''', '''setMaximum''' and '''setValue''').
+
* You set the minimum value, the maximum value and the value with the appropriate setters (<code>setMinimum()</code>, <code>setMaximum()</code> and <code>setValue()</code>).
* You can add a SelectionListener with the method '''addSelectionListener'''. The selection event is fired when the user changes the selection.
+
* You can add a SelectionListener with the method <code>addSelectionListener()</code>. The selection event is fired when the user changes the selection.
  
 
+
  final NebulaSlider slider = new NebulaSlider(shell, SWT.NONE);
<code>
+
slider.setMinimum(0);
  <nowiki>
+
slider.setMaximum(1000);
final NebulaSlider slider = new NebulaSlider(shell, SWT.NONE);
+
slider.setValue(632);
slider.setMinimum(0);
+
slider.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
slider.setMaximum(1000);
+
slider.setValue(632);
+
slider.addSelectionListener(new SelectionAdapter() {
slider.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
+
      @Override
 
+
      public void widgetSelected(SelectionEvent e) {
slider.addSelectionListener(new SelectionAdapter() {
+
          System.out.println("New value is " + slider.getValue());
@Override
+
      }
public void widgetSelected(SelectionEvent e) {
+
});
System.out.println("New value is " + slider.getValue());
+
}
+
});
+
</nowiki></code>
+
  
 
=Example=
 
=Example=
Line 40: Line 36:
 
An example called '''NebulaSliderSnippet''' is located in the plugin '''org.eclipse.nebula.widgets.nebulaslider.snippets'''.
 
An example called '''NebulaSliderSnippet''' is located in the plugin '''org.eclipse.nebula.widgets.nebulaslider.snippets'''.
  
This example is also available here : [https://git.eclipse.org/c/nebula/org.eclipse.nebula.git/tree/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaSliderSnippet.java NebulaSliderSnippet.java]
+
This example is also available here : [https://github.com/eclipse/nebula/blob/master/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaSliderSnippet.java NebulaSliderSnippet.java]

Latest revision as of 06:53, 19 March 2020

< Back to Nebula Main Page

Introduction

Nebulaslider.png


This widget is an other visualisation of a Slider. It represents an integer value which is in a range of data.

Important: This widget is currently horizontal. If you need a vertical slider, please fill a bug with Bugzilla

Usage

The usage is very simple :

  • You create a NebulaSlider widget
  • You set the minimum value, the maximum value and the value with the appropriate setters (setMinimum(), setMaximum() and setValue()).
  • You can add a SelectionListener with the method addSelectionListener(). The selection event is fired when the user changes the selection.
final NebulaSlider slider = new NebulaSlider(shell, SWT.NONE);
slider.setMinimum(0);
slider.setMaximum(1000);
slider.setValue(632);
slider.setBackground(display.getSystemColor(SWT.COLOR_WHITE));

slider.addSelectionListener(new SelectionAdapter() {
     @Override
     public void widgetSelected(SelectionEvent e) {
          System.out.println("New value is " + slider.getValue());
     }
});

Example

An example called NebulaSliderSnippet is located in the plugin org.eclipse.nebula.widgets.nebulaslider.snippets.

This example is also available here : NebulaSliderSnippet.java

Back to the top