com.google.gwt.user.client.ui.Label.setSize()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中com.google.gwt.user.client.ui.Label.setSize()方法的一些代码示例,展示了Label.setSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setSize()方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.Label
类名称:Label
方法名:setSize

Label.setSize介绍

暂无

代码示例

代码示例来源:origin: com.blackducksoftware.tools/common-framework

/**
 * Builds the copyright label.
 *
 * @return the label
 */
private Label buildCopyrightLabel() {
  Label lblCopyrightBlack = new Label(COPYRIGHT_STRING);
  lblCopyrightBlack.setSize("592px", "44px");
  return lblCopyrightBlack;
}

代码示例来源:origin: com.blackducksoftware.tools/common-framework

/**
 * Builds the server label.
 *
 * @return the label
 */
private Label buildServerLabel() {
  Label serverFieldLabel = new Label("Server:");
  serverFieldLabel.setStyleName("gwt-Login-Label");
  serverFieldLabel.setSize("51px", "21px");
  return serverFieldLabel;
}

代码示例来源:origin: com.blackducksoftware.tools/common-framework

/**
 * Builds the password label.
 *
 * @return the label
 */
private Label buildPasswordLabel() {
  Label passwordFieldLabel = new Label("Password:");
  passwordFieldLabel.setStyleName("gwt-Login-Label");
  passwordFieldLabel.setSize("73px", "21px");
  return passwordFieldLabel;
}

代码示例来源:origin: com.blackducksoftware.tools/common-framework

/**
 * Builds the user name label.
 *
 * @return the label
 */
private Label buildUserNameLabel() {
  Label userFieldLabel = new Label("User:");
  userFieldLabel.setStyleName("gwt-Login-Label");
  userFieldLabel.setSize("38px", "21px");
  return userFieldLabel;
}

代码示例来源:origin: com.blackducksoftware.tools/common-framework

/**
 * Builds the error label.
 *
 * @return the label
 */
private Label buildErrorLabel() {
  Label errorLabel = new Label();
  errorLabel.setStyleName("error-Label");
  errorLabel.setVisible(false);
  errorLabel.setSize("459px", "64px");
  return errorLabel;
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

@Override
public void getAdditionalProposalInfo(AsyncCallback<Widget> callback) {
 String documentation = macro.getDescription();
 if (documentation == null || documentation.trim().isEmpty()) {
  documentation = "No documentation found.";
 }
 Label label = new Label(documentation);
 label.setWordWrap(true);
 label.getElement().getStyle().setFontSize(13, Style.Unit.PX);
 label.getElement().getStyle().setMarginLeft(4, Style.Unit.PX);
 label.setSize("100%", "100%");
 callback.onSuccess(label);
}

代码示例来源:origin: stackoverflow.com

Label label = new Label(parent, SWT.BORDER);
 label.setSize(50, 30);
 label.setText("String");
 // Get the label size and the font data
 Point size = label.getSize();
 FontData[] fontData = label.getFont().getFontData();
 GC gc = new GC(label);
 int stringWidth = gc.stringExtent(label.getText()).x;
 // Note: In original answer was ...size.x + (double)..., must be / not +
 double widthRatio = (double) size.x / (double) stringWidth;
 int newFontSize = (int) (fontData[0].getHeight() * widthRatio);
 int componentHeight = size.y;
 int fontsizeToUse = Math.min(newFontSize, componentHeight);
 // set the font
 fontData[0].setHeight(fontsizeToUse);
 label.setFont(new Font(Display.getCurrent(), fontData[0]));
 gc.dispose();

代码示例来源:origin: com.blackducksoftware.tools/common-framework

/**
 * Builds the version label.
 *
 * @param appVersionString
 *            the app version string
 * @return the label
 */
private Label buildVersionLabel(String appVersionString) {
  Label versionLabel = new Label("");
  versionLabel.setStyleName("gwt-Version-Label");
  versionLabel.setSize("93px", "36px"); // was "93px", "18px"
  String versionToDisplay = debugMode ? LOGIN_SCREEN_VERSION_STRING
      : appVersionString;
  versionLabel.setText(versionToDisplay);
  return versionLabel;
}

代码示例来源:origin: com.blackducksoftware.tools/common-framework

/**
 * Builds the title label.
 *
 * @param title
 *            the title
 * @return the label
 */
private Label buildTitleLabel(String title) {
  Label titleLabel = new Label();
  titleLabel.setStyleName("appTitle");
  titleLabel.setVisible(true);
  titleLabel.setSize("459px", "64px");
  titleLabel.setText(title);
  return titleLabel;
}

代码示例来源:origin: stackoverflow.com

public class Page2 extends Composite {

  Button btnPage1;

  public Page2(Composite parent, int style) {
    super(parent, style);

    Label lblPage2 = new Label(this, SWT.NONE);
    lblPage2.setLocation(10, 10);
    lblPage2.setSize(80, 15);
    lblPage2.setText("I'm on Page 2");

    btnPage1 = new Button(this, SWT.NONE);
    btnPage1.setLocation(10, 30);
    btnPage1.setSize(80, 25);
    btnPage1.setText("Go to Page 1");
  }

  public void addLink(final Vector<Composite> pageVector) {
    btnPage1.addListener(SWT.Selection, new Listener() {
      @Override
      public void handleEvent(Event e) {
        App.stackLayout.topControl = pageVector.get(0);
        App.parent.layout();
      }
    });
  }
}

代码示例来源:origin: stackoverflow.com

public class Page1 extends Composite {

  Button btnPage2;

  public Page1(Composite parent, int style) {
    super(parent, style);

    Label lblPage1 = new Label(this, SWT.NONE);
    lblPage1.setLocation(10, 10);
    lblPage1.setSize(80, 15);
    lblPage1.setText("I'm on Page 1");

    btnPage2 = new Button(this, SWT.NONE);
    btnPage2.setLocation(10, 30);
    btnPage2.setSize(80, 25);
    btnPage2.setText("Go to Page 2");
  }

  public void addLink(final Vector<Composite> pageVector) {
    btnPage2.addListener(SWT.Selection, new Listener() {
      @Override
      public void handleEvent(Event e) {
        App.stackLayout.topControl = pageVector.get(1);
        App.parent.layout();
      }
    });
  }
}

相关文章