示例#1
0
  @Override
  protected JComponent createContentPane() {
    SwingFactory swingFactory = ClientCoreContext.getSwingFactory();

    JLabel userLabel =
        swingFactory.getLabel(
            new LabelDecorator(ClientCoreContext.getString("smmanager.unlock.user")));
    JLabel pwdLabel =
        swingFactory.getLabel(
            new LabelDecorator(ClientCoreContext.getString("smmanager.unlock.password")));

    userField = swingFactory.getXEditor(new StringEditorDecorator("user"));
    userField.setEditable(false);
    pwdTextField = swingFactory.getXEditor(new PasswordEditorDecorator("password"));

    double[][] ds =
        new double[][] {
          {5, 100, 5, TableLayout.FILL, 5}, swingFactory.getTableLayoutRowParam(2, 1, 1)
        };
    JPanel pane = swingFactory.getPanel(new TableLayout(ds));
    pane.add(userLabel, "1,1,f,c");
    pane.add(userField, "3,1,f,c");
    pane.add(pwdLabel, "1,3,f,c");
    pane.add(pwdTextField, "3,3,f,c");

    // init data : current user
    SmCoreClientService smCoreClientService =
        ClientCoreContext.getLocalService("smCoreClientService", SmCoreClientService.class);
    userField.setText(smCoreClientService.getCurrentUser());
    return pane;
  }