Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Nonvisible widgets

Resolve.

El Jueves, 26 de Enero de 2006 17:27, Manuel Nogales escribió:
> This is a snippet that shows it:
>
> public class VerL {
> 	public static void main(String[] args) {
> 		Shell sShell = new Shell();
> 		sShell.setLayout(new FillLayout());
> 		sShell.setSize(new org.eclipse.swt.graphics.Point(430, 170));
> 		Composite composite = new Composite(sShell, SWT.NONE);
> 		composite.setLayout(new FillLayout());
> 		try {
> 			Class clasecarga = Thread
> 					.currentThread()
> 					.getContextClassLoader()
> 					.loadClass("CompositeWithFormLayout");
> 			Class[] classes = new Class[2];
> 			classes[0] = Composite.class;
> 			classes[1] = int.class;
> 			Constructor constr = clasecarga.getConstructor(classes);
> 			Object[] param = new Object[2];
> 			param[0] = composite;
> 			param[1] = new Integer(SWT.CENTER);// this is the bug CENTER is not a 
valid style
> 			constr.newInstance(param);
> 		} catch (Exception e) {
> 			e.printStackTrace();
> 		}
> 		Display display = sShell.getDisplay();
>
> 		sShell.setVisible(true);
> 		sShell.setFocus();
> 		while (!sShell.isDisposed()) {
> 			if (!display.readAndDispatch())
> 				display.sleep();
> 		}
> 		sShell.dispose();
> 	}
> }
>
> class CompositeWithFormLayout extends Composite {
> 	private Label label1 = null;
> 	private Label label2 = null;
> 	private Label label3 = null;
> 	private Text text1 = null;
> 	private Text text2 = null;
> 	private Text text3 = null;
> 	FormLayout layout = new FormLayout();
> 	FormData data;
>
> 	public CompositeWithFormLayout(Composite parent, int style) {
> 		super(parent, style);
> 		initialize();
> 	}
>
> 	private void initialize() {
> 		createComposite();
> 		this.setBackground(Display.getCurrent().getSystemColor(
> 				SWT.COLOR_INFO_BACKGROUND));
>
> 	}
>
> 	private void createComposite() {
>
> 		this.setLayout(layout);
>
> 		label1 = new Label(this, SWT.NONE);
> 		label1
> 				.setBounds(new org.eclipse.swt.graphics.Rectangle(
> 						47,
> 						20,
> 						94,
> 						13));
> 		label1.setText("Name");
> 		label2 = new Label(this, SWT.NONE);
> 		label2
> 				.setBounds(new org.eclipse.swt.graphics.Rectangle(
> 						48,
> 						44,
> 						95,
> 						13));
> 		label2.setText("User");
> 		label3 = new Label(this, SWT.NONE);
> 		label3
> 				.setBounds(new org.eclipse.swt.graphics.Rectangle(
> 						49,
> 						71,
> 						92,
> 						13));
> 		label3.setText("Password");
> 		text1 = new Text(this, SWT.BORDER);
> 		text1
> 				.setBounds(new org.eclipse.swt.graphics.Rectangle(
> 						168,
> 						16,
> 						156,
> 						19));
> 		text2 = new Text(this, SWT.BORDER);
> 		text2
> 				.setBounds(new org.eclipse.swt.graphics.Rectangle(
> 						168,
> 						42,
> 						154,
> 						19));
> 		text3 = new Text(this, SWT.BORDER);
> 		text3
> 				.setBounds(new org.eclipse.swt.graphics.Rectangle(
> 						167,
> 						67,
> 						154,
> 						19));
>
> 		data = new FormData();
> 		data.left = new FormAttachment(0, 20);
> 		data.right = new FormAttachment(30, 0);
> 		data.top = new FormAttachment(0, 20);
> 		label1.setLayoutData(data);
>
> 		data = new FormData();
> 		data.left = new FormAttachment(0, 20);
> 		data.right = new FormAttachment(30, 0);
> 		data.top = new FormAttachment(label1, 10);
> 		label2.setLayoutData(data);
>
> 		data = new FormData();
> 		data.left = new FormAttachment(0, 20);
> 		data.right = new FormAttachment(30, 0);
> 		data.top = new FormAttachment(label2, 10);
> 		label3.setLayoutData(data);
>
> 		data = new FormData();
> 		data.left = new FormAttachment(label1, 0);
> 		data.right = new FormAttachment(100, 0);
> 		data.top = new FormAttachment(0, 20);
> 		text1.setLayoutData(data);
>
> 		data = new FormData();
> 		data.left = new FormAttachment(label2, 0);
> 		data.right = new FormAttachment(100, 0);
> 		data.top = new FormAttachment(label1, 10);
> 		text2.setLayoutData(data);
>
> 		data = new FormData();
> 		data.left = new FormAttachment(label3, 0);
> 		data.right = new FormAttachment(100, 0);
> 		data.top = new FormAttachment(label2, 10);
> 		text3.setLayoutData(data);
> 	}
> }
> It seems to be that the problem is to load the composite with
> java.lang.reflect
>
> thanks
>
> El Jueves, 26 de Enero de 2006 10:10, Carolyn MacLeod escribió:
> > Please provide a snippet that shows the problem.
> > Some example snippets using FormLayout can be found on this page:
> > http://www.eclipse.org/swt/snippets/
> >
> > Also, you might try asking your question on the SWT newsgroup:
> > news://news.eclipse.org/eclipse.platform.swt
> >
> > Thanks,
> > Carolyn
> >
> >
> >
> >
> > Manuel Nogales <mnogales@xxxxxxxxxxxxx>
> > Sent by: platform-swt-dev-bounces@xxxxxxxxxxx
> > 01/26/2006 03:43 AM
> > Please respond to
> > "Eclipse Platform SWT component developers list."
> >
> >
> > To
> > "Eclipse Platform SWT component developers list."
> > <platform-swt-dev@xxxxxxxxxxx>
> > cc
> >
> > Subject
> > [platform-swt-dev] Nonvisible widgets
> >
> >
> >
> >
> >
> >
> > hi
> >
> > I have made an application SWT on Windows, but when proving it on linux
> > some
> > widgets are not visible.  I take to several days looking for the cause
> > but I
> > am not able to find it, apparently everything is well, we used the same
> > version of the JDK (1.5), SWT (3.1.1), etc..  The only thing that they
> > have
> > in common the widgets that are not visible is that they are in a
> > FormLayout.
> > What can be the cause?
> >
> > Thanks
> > _______________________________________________
> > platform-swt-dev mailing list
> > platform-swt-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top