Skip to main content



      Home
Home » Newcomers » Newcomers » JFace "Composite" and "Control" Query
JFace "Composite" and "Control" Query [message #267715] Wed, 14 January 2009 07:01 Go to next message
Eclipse UserFriend
Hi everyone..Please could you explain as to why when we are doing a JFace
application and using the "method"

protected Control createContents(Composite parent){}

the return type is Control??

Because we are using all widgets of Composite parent and also ADDING it to
the Composite object i.e. parent..

Please explain..
Re: JFace "Composite" and "Control" Query [message #267719 is a reply to message #267715] Wed, 14 January 2009 10:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 1/14/2009 7:01 AM, adithya wrote:
> Hi everyone..Please could you explain as to why when we are doing a
> JFace application and using the "method"
>
> protected Control createContents(Composite parent){}
>
> the return type is Control??
>
> Because we are using all widgets of Composite parent and also ADDING it
> to the Composite object i.e. parent..

Because that is the most general type that can be returned.
createContents() does not have to return a Composite; the contents can
be any single Control (and don't forget that a Composite is a Control).

This seems obvious, so it is not clear exactly what you are asking...

Eric
Re: JFace "Composite" and "Control" Query [message #267810 is a reply to message #267719] Sat, 17 January 2009 06:49 Go to previous message
Eclipse UserFriend
In manning i read about the hierarchy of the widget,control,composite
,button..etc..

There "Control is below Widget below which is button and Scrollable and
others..and Composite is just below Scrollable"

In SWT/Jface programs..generally the parent is Composite right??

For e.g.

public class EditorTry7 extends ApplicationWindow
{
public EditorTry7()
{
super(null);

}

protected Control createContents(Composite parent)
{
getShell().setText("Graphical Editor ");

getShell().setBounds(200,100,600,400);
getShell().setMaximized(false);

parent.getShell().setMaximized(false);

parent.pack();
return parent;
}

public static void main(String args[])
{
EditorTry7 ET7 = new EditorTry7();
ET7.setBlockOnOpen(true);
ET7.open();

Display.getCurrent().dispose();


}

}

and the widget Button is also added to Composite object (say object name =
parent)..then how is that possible (though i have added it successfully
and executed) to add a widget to an object which is at a higher level in
the Hierarchy??!
Previous Topic:General Help
Next Topic:"Convert for loops to enhanced" save action
Goto Forum:
  


Current Time: Sun Jul 20 17:59:48 EDT 2025

Powered by FUDForum. Page generated in 0.28020 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top