如图,运行时的界面和的design的界面不一样,我想要的界面是设计显示的界面,不知道哪位有空帮帮忙?
界面的代码如下:
import org.eclipse.swt.SWT;
public class CallInterface {
private Composite composite;
protected Shell shell;
protected Image image;
protected Image image1;
/**
* Launch the application
*
* @param args
*/
public static void main(String[] args) {
try {
CallInterface window = new CallInterface();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Open the window
*/
public void open() {
final Display display = Display.getDefault();
image = new Image(display, "src/image/logo.gif");
image1 = new Image(display, "src/image/call.jpg");
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
/**
* Create contents of the window
*/
protected void createContents() {
shell = new Shell();
shell.setSize(300, 600);
shell.setText("柜员呼叫端,窗口号:001");
shell.setLayout(new GridLayout(7, true));
composite = new Composite(shell, SWT.BORDER);
GridData gridComposite = new GridData(GridData.FILL_BOTH);
gridComposite.horizontalSpan = 7;
composite.setLayoutData(gridComposite);
{
composite.setLayout(new GridLayout(5, false));
// 员工图片
Button buttonImage = new Button(composite, SWT.NONE);
GridData buttonIGD = new GridData();
buttonIGD.horizontalSpan = 1;
buttonIGD.verticalSpan = 2;
buttonImage.setLayoutData(buttonIGD);
// buttonImage.setSize(40, 50);
buttonImage.setImage(image);
Composite c1 = new Composite(composite, SWT.NONE);
GridData c1GridData = new GridData(GridData.END);
c1GridData.horizontalSpan = 4;
c1.setLayoutData(c1GridData);
{
c1.setLayout(new GridLayout(5, false));
// 工号
final Label userNo = new Label(c1, SWT.NONE);
GridData noGridData = new GridData();
noGridData.horizontalSpan = 2;
userNo.setLayoutData(noGridData);
userNo.setText("工号:");
GridData textGridData = new GridData();
textGridData.horizontalSpan = 2;
final Text text = new Text(c1, SWT.READ_ONLY | SWT.NONE
| SWT.WRAP);
text.setText("0011");
text.setLayoutData(textGridData);
// 员工名字
final Label userNameLabel = new Label(c1, SWT.NONE);
GridData nameGridData = new GridData();
nameGridData.horizontalSpan = 2;
userNameLabel.setLayoutData(nameGridData);
userNameLabel.setText("名字:");
final Text nameText = new Text(c1, SWT.READ_ONLY | SWT.NONE
| SWT.WRAP);
nameText.setText("MICROSOFT");
nameText.setLayoutData(textGridData);
}
// 定义labSeparator分隔符标签,并对其进行布局
final Label labSeparator = new Label(composite, SWT.SEPARATOR
| SWT.HORIZONTAL);
GridData gridSeparator = new GridData(GridData.FILL_HORIZONTAL);
gridSeparator.horizontalSpan = 5;
gridSeparator.verticalSpan = 2;
labSeparator.setLayoutData(gridSeparator);
Composite c2 = new Composite(composite, SWT.BORDER);
GridData c2GridData = new GridData(GridData.FILL_BOTH);
c2GridData.horizontalSpan = 5;
c2GridData.verticalSpan = 10;
c2.setLayoutData(c2GridData);
{
c2.setLayout(new GridLayout(5, false));
TabFolder tabFolder = new TabFolder(c2, SWT.NONE);
GridData tabGridData = new GridData(GridData.FILL_BOTH);
tabGridData.horizontalSpan = 5;
tabFolder.setLayoutData(tabGridData);
// 第一个选项卡
{
GridData itemGridData = new GridData();