Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Form control

Form is a basic control used to host UI Forms. It provides for setting a title and scrolling the content similar to a Web browser. What makes forms appealing is the fact that the content is an SWT composite that can be used as you would use it in other contexts. For example, consider the following code snippet:

public class FormView extends ViewPart {
	private FormToolkit toolkit;
	private ScrolledForm form;
	/**
	 * The constructor.
	 */
	public FormView() {
	}
	/**
	 * This is a callback that will allow us to create the viewer and
	 * initialize it.
	 */
	public void createPartControl(Composite parent) {
		toolkit = new FormToolkit(parent.getDisplay());
		form = toolkit.createScrolledForm(parent);
		form.setText("Hello, Eclipse Forms");
	}
	/**
	 * Passing the focus request to the form.
	 */
	public void setFocus() {
		form.setFocus();
	}
	/**
	 * Disposes the toolkit
	 */
	public void dispose() {
		toolkit.dispose();
		super.dispose();
	}
}

UI Forms manipulate SWT widgets in a number of ways in order to achieve the desired effect. For that reason, controls are typically created using the FormToolkit. Normally an instance of a ScrolledForm is created in order to get scrolling. When forms need to be nested, a Form instance provides everything except for scrolling of the form content.

Form content is rendered below the title. SWT widgets are created in the form using Form.getBody() as a parent.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire