Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » JFace need wrapper
JFace need wrapper [message #717792] Mon, 22 August 2011 11:39
kachwahed is currently offline kachwahedFriend
Messages: 1
Registered: August 2011
Junior Member
Hello everyone,
Is it possible to build JFace wrapper from ApplicationWindow, without hiding SWT and widgets, this may simplify using window, something like:
public class SimpleFace /*extends JFace*/ {
	
	public static void main(String[] args) {
		JFace f = new JFace(null);
//		JFace f = new JFace("Hello World");
		f.setTitle("Hello World!");//Optional
		f.setSize(300, 200);//Optional
		f.open();
	}
}
class JFace extends Window {
	private String title;
	private Point size;
	public String getTitle() {
		return title;
	}
	public Point getSize() {
		return size;
	}
	public void setSize(int width, int height) {
		setSize(new Point(width, height));
	}
	public void setSize(Point size) {
		this.size = size;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public JFace(String title) {
		this(null, title);
	}
	public JFace(Shell parentShell, String title) {
		super(parentShell);
		this.setTitle(title);
		
	}
	protected void configureShell(Shell shell) {
		super.configureShell(shell);
		shell.setText(getTitle()!=null?getTitle():"");
		if (getSize() != null)
			shell.setSize(getSize());
	}
	@Override
	public int open() {
		return this.open(true);
	}
	public int open(boolean shouldBlock) {
		setBlockOnOpen(shouldBlock);
		int result=super.open();
		Display.getCurrent().dispose();
		return result;
	}
}

and may add widgets to the Face/Composite using add() method, this can be easy to convert from Swing/AWT UI.
Previous Topic:the use of IProgressService
Next Topic:Model View Controler
Goto Forum:
  


Current Time: Sat Apr 20 03:56:02 GMT 2024

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

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

Back to the top