DarkPanel - Haixing-Hu/swt-widgets GitHub Wiki
This is the DarkPanel
widget comes from the OPAL project. It can be use to put focus on a particular element by making the other content of the window darker.
Usage
The usage is very simple :
- Create a
DarkPanel
. - Change the alpha value of the
DarkPanel
. - Open the panel with the method
show()
. - Close the panel with the method
hide()
.
Here is the code snippet:
final DarkPanel p = new DarkPanel(shell);
...
final Button ok = new Button(shell, SWT.PUSH);
ok.setText("Ok");
...
ok.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(final SelectionEvent e) {
p.show();
Dialog.isConfirmed("Confirmation",
"Are you sure you want to save this form ?");
p.hide();
}
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
....
}
});
Example
An example is located in the source repository:
src/test/java/com/github/haixing_hu/swt/window/DarkPanelExample.java