Results 1 to 1 of 1
Thread: HTML Form
-
HTML Form
Java Code: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 Test { 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 Test().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()); // // } // // }); } }"The sole cause of man’s unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal
Similar Threads
-
how to search xml file data based on the given keyword from html form?
By nicemothi in forum XMLReplies: 0Last Post: 04-04-2008, 09:36 AM -
Getting HTML form values in Servlet
By Java Tip in forum Java TipReplies: 0Last Post: 11-17-2007, 08:13 PM -
center a form
By tommy in forum New To JavaReplies: 2Last Post: 08-06-2007, 08:47 PM -
how to upload a file along with html form data
By pranith in forum Java ServletReplies: 3Last Post: 07-30-2007, 02:33 AM -
Form Help Pls
By CoOlbOyCoOl in forum NetBeansReplies: 4Last Post: 05-27-2007, 08:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks