Refine search
Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); shell.setText("Hide Label"); button.setText("hide"); button.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { Button b = (Button) e.widget; GridData data = (GridData) bHidden.getLayoutData(); data.exclude = b.getSelection(); bHidden.setVisible(!data.exclude); shell.layout(false); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); display.dispose();
public static void main( String[] args ) { Display display = new Display(); Shell shell = new Shell( display ); shell.setLayout( new FillLayout() ); final Table table = new Table( shell, SWT.VIRTUAL ); table.setItemCount( 10000 ); table.addListener( SWT.SetData, new Listener() { public void handleEvent( Event event ) { TableItem item = (TableItem)event.item; item.setText( "Item " + table.indexOf( item ) ); } } ); shell.setSize( 300, 500 ); shell.open(); while( !shell.isDisposed() ) { if( !display.readAndDispatch() ) { display.sleep(); } } display.dispose(); }
shell.setLayout(new GridLayout(1, true)); button.setText("Resize"); button.addListener(SWT.Selection, new Listener() shell.layout(); shell.pack(); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); display.dispose();
Display display = new Display (); final Color green = display.getSystemColor (SWT.COLOR_GREEN); final Color orig = shell.getBackground(); display.addFilter(SWT.KeyDown, new Listener() { shell.addKeyListener(new KeyListener() { public void keyReleased(KeyEvent e) { if(((e.stateMask & SWT.CTRL) == SWT.CTRL) && (e.keyCode == 'f')) shell.setBackground(orig); System.out.println("Key up !!");
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); shell.setText("StackOverflow"); shell.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event arg0) { if(shell.getMaximized()) System.out.println("Maximize"); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
Display display = new Display(); final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); button.setText("Calculate"); button.addListener(SWT.Selection, new Listener() shell.pack(); shell.setSize(400, 200); shell.open();
final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); dummy.setText("Dummy"); shell.addListener(SWT.Move, new Listener() { shell.addListener(SWT.Iconify, new Listener() { shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep();
final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); button.setText("Change cursor"); button.addListener(SWT.Selection, new Listener() { shell.setCursor(cursor); shell.setSize(200,200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep();
public static void main( String[] args ) { Listener listener = new Listener() { @Override public void handleEvent( Event event ) { System.out.println( event ); } }; Display display = new Display(); Shell shell = new Shell( display ); shell.setText( "Shell" ); shell.addListener( SWT.MouseDown, listener ); Button button = new Button( shell, SWT.PUSH ); button.setText( "Button" ); button.setBounds( 100, 100, 400, 100 ); button.addListener( SWT.MouseDown, listener ); shell.setSize( 600, 600 ); shell.open(); while( !shell.isDisposed() ) { if( !display.readAndDispatch() ) display.sleep(); } display.dispose(); }
composite.addListener(SWT.Resize, new Listener() { public void handleEvent(Event e) { changeImage(); Shell shell = new Shell(display); try { shell.setSize(200, 100); shell.setLayout(new FillLayout()); createComponents(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) {
parent.setLayout(new FillLayout()); ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL); scrollBox.setExpandHorizontal(true); mParent.addListener(SWT.Resize, new Listener() { int width = -1; public void handleEvent(Event e) {
/** * The work item to be executed. * * this must be private as it should only be called once. otherwise we leak listener threads */ private void addService( Service service, ServerSocket serverSocket ) { try { _listener = new Listener( serverSocket, service ); _listener.setDaemon(true); tsLogger.logger.debug(service.getClass().getName() + " starting"); _listener.start() ; } catch ( IOException ex ) { tsLogger.i18NLogger.warn_recovery_TransactionStatusManager_2(); } }
while ( !stopRequested() ) if (addConnection(conn)) {
private Label fieldLabel = new Label(shell, SWT.NONE); public void testMethod() { Button button = new Button(shell, SWT.PUSH); button.setText("Print"); final Label finalLabel = new Label(shell, SWT.NONE); button.addListener(SWT.Selection, new Listener(){ @Override public void handleEvent(Event e) { fieldLabel.setText("TEXT"); finalLabel.setTexT("TEXT"); } }) }
/** * Halts running of the listener thread. */ public synchronized void stopListener() { closeListenerSockets(); // there is no need for this as the close will interrupt any i/o that is in progress // this.interrupt(); // ok, closing a connection socket will cause the connection thread to remove it from the list as it // exits so we keep on closing them and waiting until the list is empty while(connections.size() > 0) { Socket conn = connections.get(0); try { conn.close(); } catch (Exception e) { // ignore } try { wait(); } catch (InterruptedException e) { // ignore } } // make sure this listener thread has exited before we return try { this.join(); } catch (InterruptedException ie) { } }
_listener.closeListenerSockets(); _listener.stopListener();
public void shutdown() { if (_listener != null) { _listener.stopListener() ; TransactionStatusManagerItem.removeThis( Utility.getProcessUid() ) ; _listener = null; } } /**
public void run() { removeConnection(_conn); } };
final Button setButton = new Button(composite, SWT.PUSH); setButton.setText("Set"); setButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { // some code here } }); MenuItem clickMenuItem = new MenuItem(testMenu, SWT.PUSH); clickMenuItem.setText("Click"); clickMenuItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { setButton.notifyListeners(SWT.Selection, new Event()); } });