public void addListener(Listener listener) { if ( showMonthYear ) { dateClock.addListener( SWT.Selection, listener ); } if ( showTime ) { timeClock.addListener( SWT.Selection, listener ); } }
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection, typedListener); addListener (SWT.DefaultSelection, typedListener);
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection, typedListener); addListener (SWT.DefaultSelection, typedListener);
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection, typedListener); addListener (SWT.DefaultSelection, typedListener);
addListener( SWT.Selection, typedListener ); addListener( SWT.DefaultSelection, typedListener );
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection, typedListener); addListener (SWT.DefaultSelection, typedListener);
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection, typedListener); addListener (SWT.DefaultSelection, typedListener);
popupCalendar.addListener (SWT.Selection, new Listener() { public void handleEvent(Event event) { int year = popupCalendar.getYear (); addListener (SWT.Dispose, new Listener() { public void handleEvent(Event event) { if (popupShell != null && !popupShell.isDisposed ()) { addListener(SWT.FocusOut, new Listener() { public void handleEvent(Event event) { hideCalendar();
void createPopupShell (int year, int month, int day) { popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); popupCalendar = new DateTime (popupShell, SWT.CALENDAR); if (font != null) popupCalendar.setFont (font); if (fg != null) popupCalendar.setForeground (fg); if (bg != null) popupCalendar.setBackground (bg); mouseEventListener = new Listener () { @Override public void handleEvent (Event event) { if (event.widget instanceof Control) { Control c = (Control)event.widget; if (c != down && c.getShell () != popupShell) dropDownCalendar (false); } } }; int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint}; for (int i=0; i < listeners.length; i++) { popupShell.addListener (listeners [i], popupListener); } listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose}; for (int i=0; i < listeners.length; i++) { popupCalendar.addListener (listeners [i], popupListener); } addListener (SWT.Dispose, popupListener); if (year != -1) popupCalendar.setDate (year, month, day); }
void createPopupShell (int year, int month, int day) { popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); popupCalendar = new DateTime (popupShell, SWT.CALENDAR); if (font != null) popupCalendar.setFont (font); if (fg != null) popupCalendar.setForeground (fg); if (bg != null) popupCalendar.setBackground (bg); mouseEventListener = new Listener () { @Override public void handleEvent (Event event) { if (event.widget instanceof Control) { Control c = (Control)event.widget; if (c != down && c.getShell () != popupShell) dropDownCalendar (false); } } }; int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint}; for (int i=0; i < listeners.length; i++) { popupShell.addListener (listeners [i], popupListener); } listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose}; for (int i=0; i < listeners.length; i++) { popupCalendar.addListener (listeners [i], popupListener); } addListener (SWT.Dispose, popupListener); if (year != -1) popupCalendar.setDate (year, month, day); }
void createPopupShell (int year, int month, int day) { popupShell = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); popupCalendar = new DateTime (popupShell, SWT.CALENDAR); if (font != null) popupCalendar.setFont (font); if (fg != null) popupCalendar.setForeground (fg); if (bg != null) popupCalendar.setBackground (bg); mouseEventListener = new Listener () { @Override public void handleEvent (Event event) { if (event.widget instanceof Control) { Control c = (Control)event.widget; if (c != down && c.getShell () != popupShell) dropDownCalendar (false); } } }; int [] listeners = {SWT.Close, SWT.MouseUp, SWT.Paint}; for (int i=0; i < listeners.length; i++) { popupShell.addListener (listeners [i], popupListener); } listeners = new int [] {SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose}; for (int i=0; i < listeners.length; i++) { popupCalendar.addListener (listeners [i], popupListener); } addListener (SWT.Dispose, popupListener); if (year != -1) popupCalendar.setDate (year, month, day); }
createDropDownButton (); createPopupShell (-1, -1, -1); addListener (SWT.Resize, new Listener () { @Override public void handleEvent (Event event) {
createDropDownButton (); createPopupShell (-1, -1, -1); addListener (SWT.Resize, new Listener () { @Override public void handleEvent (Event event) {
createDropDownButton (); createPopupShell (-1, -1, -1); addListener (SWT.Resize, new Listener () { @Override public void handleEvent (Event event) {