Criando Multiplas Janelas em SWT

Criação de Multiplas Janela utilizando o SWT. Utilizando a IDE Eclipse, gere as classes abaixo para ver a execução de multiplas janelas utilizando o SWT.

package br.com.tclsoftware.shell;

import org.eclipse.swt.widgets.Shell;

/**

*

Project Name: shell

*

File Name: ChildShell.java

*

Description:

*

Copyright: Copyright © 2006 TCL Software. All right reserved.

*

Company: TCL Software

*

* @author TCL Software

* @version 1.0

*/

public final class ChildShell {

/** Objetos */

Shell child = null;

/**

* Construtor com parametros

*

* @param parent Shell

*/

public ChildShell(Shell parent) {

child = new Shell(parent);

child.setSize(200, 200);

child.open();

}

}

 

 

package br.com.tclsoftware.shell;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

/**
 *

Project Name: shell


 *

File Name: ChildShellTest.java


 *

Description:


 *

Copyright: Copyright © 2006 TCL Software. All right reserved.


 *

Company: TCL Software


 *
 * @author TCL Software
 * @version 1.0
 */

public final class ChildShellTest {

 /** Objetos */
 Display d = null;
 Shell s = null;
 
 /**
  * Construtor
  */
 public ChildShellTest() {
  d = new Display();
  s = new Shell(d);
  s.setSize(500, 500);
  s.setMaximized(true);
  s.open();
  // Utilizado esta anotacao para nao gerar (WARN) aviso...
  @SuppressWarnings("unused")
  final ChildShell cs1 = new ChildShell(s);
  @SuppressWarnings("unused")
  final ChildShell cs2 = new ChildShell(s);
  @SuppressWarnings("unused")
  final ChildShell cs3 = new ChildShell(s);
  while(!s.isDisposed()) {
   if(!d.readAndDispatch()) {
    d.sleep();
   }
  }
  d.dispose();
 }

 /**
  * @param args String[]
  */
 public static void main(String[] args) {
  new ChildShellTest();
 }
}

 

Artigos relacionados