Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » SashForm error after resizing objects after move(SashForm show an error after user try to resize an object after change the position of it)
SashForm error after resizing objects after move [message #902104] Wed, 15 August 2012 16:54
Arthur Fücher is currently offline Arthur Fücher
Messages: 59
Registered: August 2012
Member
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
	}

}
Previous Topic:How add restriction to add a new component
Next Topic:Re: How add restriction to delete a component
Goto Forum:
  


Current Time: Tue Jul 22 19:36:59 EDT 2014

Powered by FUDForum. Page generated in 0.01567 seconds