I mainly create SWT apps so my questions apple to that.
When Designer creates a Shell widget below.
- Code: Select all
public class ShelTst extends Shell {
/**
* Launch the application.
* @param args
*/
public static void main(String args[]) {
try {
Display display = Display.getDefault();
ShelTst shell = new ShelTst(display);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the shell.
* @param display
* @param style
*/
public ShelTst(Display display) {
super(display, SWT.SHELL_TRIM);
createContents();
}
/**
* Create contents of the window.
*/
protected void createContents() {
setText("SWT Application");
setSize(450, 300);
}
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}
The SWT.SHELL_TRIM style was moved to the super call in ShellTst constructor.
Whats the advantage to this?
Note: Comment was created wrong for ShellTst constructor.
The reason I ask is that my old programs that were created with 6.9 pass the style into the ShellTst constructor which causes a problem I am having.
When I switch to designer mode with a Shell widget class that was created with 6.9 I get no Shell Trim and if I click on the "Quickly test/preview' button I can not close the preview window because their is no shell trim. see 6.9 code below.
- Code: Select all
public class TTable extends Shell {
/**
* Launch the application
* @param args
*/
public static void main(String args[]) {
try {
Display display = Display.getDefault();
TTable shell = new TTable(display, SWT.SHELL_TRIM);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the shell
* @param display
* @param style
*/
public TTable(Display display, int style) {
super(display, style);
createContents();
}
/**
* Create contents of the window
*/
protected void createContents() {
setText("Shell 6.9 Example");
setSize(500, 375);
setLayout(new FormLayout());
//
}
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}
Also I have played with the keys settings trying to get back the ability to switch from source to designer and back with the F12 key like I use to be able to do in 6.9.
Can you tell me how to get F12 back?
Thanks
Kelly