Exemplo n.º 1
0
  protected Control createContents(Composite parent) {
    ViewForm form = new ViewForm(parent, SWT.NONE);
    form.setSize(400, 290);
    final Composite shell = new Composite(form.getShell(), SWT.NONE);
    Label lbApp1 = new Label(shell, SWT.NONE);
    lbApp1.setText("Version:");
    lbApp1.setBounds(10, 10, 50, 20);
    controls.add(lbApp1);
    Label lbApp2 = new Label(shell, SWT.NONE);
    lbApp2.setText("noti-J 1.0");
    lbApp2.setBounds(UIUtils.getBoundsH(lbApp1, 10, 100));
    controls.add(lbApp2);

    Label lbStatus1 = new Label(shell, SWT.NONE);
    lbStatus1.setText("State:");
    lbStatus1.setBounds(UIUtils.getBoundsV(lbApp1, 10));
    controls.add(lbStatus1);
    Label lbStatus2 = new Label(shell, SWT.NONE);
    lbStatus2.setText(connected ? "connected" : "disconnect");
    lbStatus2.setForeground(
        Display.getDefault().getSystemColor(connected ? SWT.COLOR_BLUE : SWT.COLOR_RED));
    lbStatus2.setBounds(UIUtils.getBoundsV(lbApp2, 10));
    controls.add(lbStatus2);

    Label lbUser1 = new Label(shell, SWT.NONE);
    lbUser1.setText("Account:");
    lbUser1.setBounds(UIUtils.getBoundsV(lbStatus1, 10));
    controls.add(lbUser1);
    Label lbUser2 = new Label(shell, SWT.NONE);
    lbUser2.setText(userid + "(" + userName + ")");
    lbUser2.setBounds(UIUtils.getBoundsV(lbStatus2, 10));
    controls.add(lbUser2);

    Label lbLic1 = new Label(shell, SWT.NONE);
    lbLic1.setText("License:");
    lbLic1.setBounds(UIUtils.getBoundsV(lbUser1, 10));
    controls.add(lbLic1);
    Label lbLic2 = new Label(shell, SWT.NONE);
    lbLic2.setText("GPL 3.0");
    lbLic2.setBounds(UIUtils.getBoundsV(lbUser2, 10));
    controls.add(lbLic2);

    Label lbDev1 = new Label(shell, SWT.NONE);
    lbDev1.setText("Author:");
    lbDev1.setBounds(UIUtils.getBoundsV(lbLic1, 10));
    controls.add(lbDev1);
    Label lbDev2 = new Label(shell, SWT.NONE);
    lbDev2.setText("Jong-Bok,Park([email protected])");
    lbDev2.setBounds(UIUtils.getBoundsV(lbLic2, 10, 300));
    controls.add(lbDev2);

    Text txError = new Text(shell, SWT.NONE | SWT.WRAP);
    txError.setText(errorMsg == null ? "" : errorMsg);
    txError.setBounds(UIUtils.getBoundsV(lbDev1, 10, 300, 100));
    txError.setEditable(false);
    controls.add(txError);
    controls.add(form);
    return form;
  }