1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| sShell.addKeyListener(new org.eclipse.swt.events.KeyAdapter() {
public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
if ( e.keyCode == SWT.ESC )
{
MessageBox mb = new MessageBox(FrameVisuDiapo.this.sShell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
mb.setMessage("Voulez-vous quitter ?");
mb.setText("Exit ?");
int value = mb.open();
if (value == SWT.YES)
FrameVisuDiapo.this.sShell.close();
}
else if ( e.keyCode == SWT.ARROW_LEFT )
FrameVisuDiapo.this.BMPreced();
else if ( e.keyCode == SWT.ARROW_RIGHT )
FrameVisuDiapo.this.BMSuivant();
}
}); |