Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] About RowLayout (SWT3.0 vs SWT3.4)

Hello everybody!
I have code like following:
-------------------------------------
package basic;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class RowLayoutTester {
 /**
  * @param args
  */
 public static void main(String[] args) {
  final Display display = Display.getDefault();
  final Shell shell = new Shell();
  shell.setSize(327, 253);
  shell.setText("SWT Application");
  shell.setLayout(new GridLayout(1,true));
  Composite parent = new Composite(shell, SWT.BORDER);
  parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  parent.setLayout(new RowLayout());
  for (int i = 0; i < 10; i++) {
   CLabel simulatorLabel = new CLabel(parent, SWT.WRAP);
   simulatorLabel.setText("Simulator" + i);
  }
  shell.layout();
  shell.open();
  while (!shell.isDisposed()) {
   if (!display.readAndDispatch())
    display.sleep();
  }
  display.dispose();
 }
}
-------------------------------------
1,When i run this app in swt3.0(version 3.064):
--1.1,screen is shown like "RowLayout3.0.JPG"(only one row and not wrap all the CLabel).
--1.2,and when i changing the shell's size,the screen also not wrap all the CLabel.
2,When i run this app in swt3.4(version 3.449):
--2.1,screen is shown like "RowLayout3.4.JPG"(automatically wrap all the CLabel in multi-row).
--2.2,when i changing the shell's size,the row will increase or decrease,and all the CLabel will be wrapped in rows.
 
it is the SWT3.0's bug?
or
how can i do in swt3.0 for all the CLabel can be wrapped in rows.
 
Thanks in advance.
qingkang xu.



网易邮箱,中国第一大电子邮件服务商

Attachment: RowLayout3.4.JPG
Description: JPEG image

Attachment: RowLayout3.0.JPG
Description: JPEG image


Back to the top