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

Nebula LED

< Back to Nebula Main Page

Introduction

Ledwidget.png

This widget displays characters as if they were displayed on a LED.

Usage

3 components are available.

LED

This component displays a single character, and possibly a dot in the left bottom corner of the widget. To set the character to display you have to pick a value in the enumeration LEDCharacter : all letters and digits are available, plus 2 special values : CLEAR to display a blank widget (no element is lit) and MINUS to display a dash character.

Character no dot.png

LED led = new LED(top, SWT.NONE);
led.setCharacter(LEDCharacter.THREE);

If you want to display the dot in the left bottom corner, you have to set the flag SWT.ICON. To switch on/off the light, you can use the method setShowDot(boolean value)

Character dot.png

LED led = new LED(composite, SWT.ICON);
led.setCharacter(LEDCharacter.THREE);
led.setShowDot(true);

DotsLed

This component display a colon :

Ledcolon.png

To switch on/off the colon, you have to use the methods switchOn() and switchOff()

DotsLed dots = new DotsLed(composite, SWT.NONE);
dots.switchOn();

LEDSeparator

This components displays a separator (thin line, white by default)

Ledseparator.png

LEDSeparator sep = new LEDSeparator(composite, SWT.NONE);

Customization

Because the widget is a canvas, you can change the background color with the method setBackground(...).

For the LEDS, you can change the color of the line with the method setForeground(...)

For both LED and DotsLed components, you can change the idle and selected color with the suitable method :

LED led = new LED(top, SWT.NONE);
led.setCharacter(LEDCharacter.A);

Color idleColor = new Color(shell.getDisplay(), 60, 60, 60);
led.setIdleColor(idleColor);

Color selectedColor = new Color(shell.getDisplay(), 255, 0, 0);
led.setSelectedColor(selectedColor);

Example

An example called LEDSnippet.java is located in the plugin org.eclipse.nebula.widgets.led.snippets.

This example is also available here : LEDSnippet.java

Back to the top