HTML Form : Form « SWT JFace Eclipse « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Collections Data Structure
8. Database SQL JDBC
9. Design Pattern
10. Development Class
11. Email
12. Event
13. File Input Output
14. Game
15. Hibernate
16. J2EE
17. J2ME
18. JDK 6
19. JSP
20. JSTL
21. Language Basics
22. Network Protocol
23. PDF RTF
24. Regular Expressions
25. Security
26. Servlets
27. Spring
28. Swing Components
29. Swing JFC
30. SWT JFace Eclipse
31. Threads
32. Tiny Application
33. Velocity
34. Web Services SOA
35. XML
Microsoft Office Word 2007 Tutorial
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Java » SWT JFace Eclipse » FormScreenshots 
HTML Form
HTML Form


/*******************************************************************************
 * All Right Reserved. Copyright (c) 1998, 2004 Jackwind Li Guojie
 
 * Created on 2004-6-11 15:12:57 by JACK $Id$
 *  
 ******************************************************************************/
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.Section;

public class SWTTest {

  private FormToolkit toolkit;
  private Form form;
  private Display display;
  private Shell shell;
  private Hyperlink link;
  private Section section1, section2, section3;
  private FormText rtext;
  private Composite client1, client2, client3;
  private Text text;
  private Button button2;
  private Label label;

  static public void main(String args[]) {

    new SWTTest().run();

  }

  private void run() {

    setupShell();

    setupToolkit();

    createFormStructure();

    addLayout();

    addHooks();

    shell.pack();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();

    }

    display.dispose();

  }

  private void createFormStructure() {

    // form

    form = toolkit.createForm(shell);

    form.setText("Eclipse Forms");
    
    Button button = toolkit.createButton(form.getBody()"Test", SWT.NULL);
    
    form.getBody().setLayout(new GridLayout());

    //form.setBackgroundImage(new Image(display, "java2s.gif"));
  }

  private String getHTML() {

    StringBuffer buf = new StringBuffer();

    buf.append("<form>");

    buf.append("<p>");

    buf.append("Here is some plain text for the text to render; ");

    buf.append(
      "this text is at <a href=\"http://www.eclipse.org\" nowrap=\"true\">http://www.eclipse.org</a> web site.");

    buf.append("</p>");

    buf.append("<p>");

    buf.append(
      "<span color=\"header\" font=\"header\">This text is in header font and color.</span>");

    buf.append("</p>");

    buf.append(
      "<p>This line will contain some <b>bold</b> and some <span font=\"text\">source</span> text. ");

    buf.append("We can also add <img href=\"image\"/> an image. ");

    buf.append("</p>");

    buf.append("<li>A default (bulleted) list item.</li>");

    buf.append("<li>Another bullet list item.</li>");

    buf.append(
      "<li style=\"text\" value=\"1.\">A list item with text.</li>");

    buf.append(
      "<li style=\"text\" value=\"2.\">Another list item with text</li>");

    buf.append(
      "<li style=\"image\" value=\"image\">List item with an image bullet</li>");

    buf.append(
      "<li style=\"text\" bindent=\"20\" indent=\"40\" value=\"3.\">A list item with text.</li>");

    buf.append(
      "<li style=\"text\" bindent=\"20\" indent=\"40\" value=\"4.\">A list item with text.</li>");

    buf.append("</form>");

    return buf.toString();

  }

  private void setupToolkit() {

    toolkit = new FormToolkit(display);

  }

  private void setupShell() {

    display = new Display();

    shell = new Shell(display);

    shell.open();

  }

  private void addLayout() {

    // shell

    shell.setLayout(new FillLayout());

    //form

//    form.getBody().setLayout(new TableWrapLayout());
//
//    section1.setLayoutData(new TableWrapData(TableWrapData.FILL));
//
//    section2.setLayoutData(new TableWrapData(TableWrapData.FILL));
//
//    section3.setLayoutData(new TableWrapData(TableWrapData.FILL));
//
//    // client1
//
//    client1.setLayout(new GridLayout());
//
//    // client2
//
//    client2.setLayout(new GridLayout());
//
//    // // client3
//
//    GridLayout layout = new GridLayout();
//
//    client3.setLayout(layout);
//
//    layout.numColumns = 2;
//
//    // client3->text
//
//    text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
//
//    // client3->button2
//
//    GridData gd = new GridData();
//
//    gd.horizontalSpan = 2;
//
//    button2.setLayoutData(gd);

  }

  private void addHooks() {

//    section1.addExpansionListener(new ExpansionAdapter() {
//
//      public void expansionStateChanged(ExpansionEvent e) {
//
//        System.out.println("expansionbutton clicked!");
//
//      }
//
//    });
//
//    link.addHyperlinkListener(new HyperlinkAdapter() {
//
//      public void linkActivated(HyperlinkEvent e) {
//
//        System.out.println("Link active: " + e.getLabel());
//
//      }
//
//    });

  }
}
           
       
Related examples in the same category
1. Custom ComponentsCustom Components
2. Email FormEmail Form
3. Simple Form 1Simple Form 1
w_w__w_.j__a__v_a_2___s_._co_m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.