SashForm error after resizing objects after move [message #902104] |
Wed, 15 August 2012 20:54 |
Eclipse User |
|
|
|
Hi,
I'm doing tests with SashForm and it show an error in this situation:
1.Create a SWT Shell;
2.Add FillLayout;
3.Add SashForm;
4.Add a Button;
5.Add another Button in the left of the other into SashForm;
In this point, the left Button has a DragTrackerTool in the RIGHT side that allow the user to resize it.
6.Move the right Button in the place of the another button, making they change position in SashForm;
Now the new left Button doesn't have the DragTrackerTool, and the new right Button have DragTrackerTool in his right side...
Just try to resize and it will show this error:
java.lang.ArrayIndexOutOfBoundsException: 2
This is a known error? Have a solution?
Here is the code with error:
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.custom.SashForm;
public class aser extends Shell {
/**
* Launch the application.
* @param args
*/
public static void main(String args[]) {
try {
Display display = Display.getDefault();
aser shell = new aser(display);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the shell.
* @param display
*/
public aser(Display display) {
super(display, SWT.SHELL_TRIM);
setLayout(new FillLayout(SWT.HORIZONTAL));
SashForm sashForm = new SashForm(this, SWT.NONE);
Button btnNewButton = new Button(sashForm, SWT.NONE);
btnNewButton.setText("New Button");
Button btnNewButton_1 = new Button(sashForm, SWT.NONE);
btnNewButton_1.setText("New Button");
sashForm.setWeights(new int[] {1, 1});
createContents();
}
/**
* Create contents of the shell.
*/
protected void createContents() {
setText("SWT Application");
setSize(450, 300);
}
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.02603 seconds