JFace need wrapper [message #717792] |
Mon, 22 August 2011 11:39 |
kachwahed 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.
|
|
|
Powered by
FUDForum. Page generated in 0.03015 seconds