|
||
![]() |
|
![]() |
|
Table of Contents
Custom Widget TelnetSWTDescriptionThis wigdet is based on JTA (Version 2.6), a Swing stand alone application which is a Telnet Client. I have used a SWT_AWT bridge to create my own Custom SWT widget named TelnetSWT. TelnetSWT extends Composite(), all Composite’s methods are available. Download TelnetConsole How to use itBuild PathThe custom widget TelnetSWT is available in TelnetConsole_V1.0.0.jar. You just have to include it into the Build path of your SWT application. (Eclipse:Configure build path–>add externals jar) Configuration fileHost url and menus can be set in configConsoleTelnet.xml. TelnetConsole_V1.0.0.jar includes a sample file, you just have to put such a file in your SWT project folder. Config file : <config> <url>127.0.0.1</url> <menu> <showFile>true</showFile> <showEdit>true</showEdit> <showTerminal>true</showTerminal> <showHelp>true</showHelp> </menu> </config>
Your code
To display the Telnet Console into your SWT application, you have to set a Layout in your shell and create a console as following TelnetSWT myConsole = new TelnetSWT (shell,SWT.NULL | SWT.EMBEDDED);
Here you find a snippet showing how to include a Telnet Console in your SWT application : import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import fr.improve.telnet.TelnetSWT; public class TutoTestWidget { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Display display = new Display(); Shell shell = new Shell(display); shell.setText("Telnet SWT "); shell.setLayout(new FillLayout()); try { TelnetSWT maConsole = new TelnetSWT (shell,SWT.NULL | SWT.EMBEDDED); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } shell.open(); while(!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } } — Cedric KERMORGANT 2006/10/08 14:11 |
||