In addition, you can use control jewelry for this. The advantage is that you can easily hide / show the notification using the hide() and show() methods and add the text of the prompt and listeners to it.
Check out the blog how to use the control. Use Button widget instead of Text for your case.
Create a notification image as shown below and set a ControlDecoration object for it.
Image image = new Image(display, 20, 25); GC gc = new GC(image); gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); gc.fillRectangle(0, 0, 20, 25); gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); int notif = 5; gc.drawText(new Integer(notif).toString(), 5, 5); gc.dispose();
source share