com.badlogic.gdx.scenes.scene2d.ui.Label.setStyle()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(142)

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

Label.setStyle介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

public void setStyle (ButtonStyle style) {
  if (style == null) throw new NullPointerException("style cannot be null");
  if (!(style instanceof TextButtonStyle)) throw new IllegalArgumentException("style must be a TextButtonStyle.");
  super.setStyle(style);
  this.style = (TextButtonStyle)style;
  if (label != null) {
    TextButtonStyle textButtonStyle = (TextButtonStyle)style;
    LabelStyle labelStyle = label.getStyle();
    labelStyle.font = textButtonStyle.font;
    labelStyle.fontColor = textButtonStyle.fontColor;
    label.setStyle(labelStyle);
  }
}

代码示例来源:origin: libgdx/libgdx

public void setStyle (ButtonStyle style) {
  if (style == null) throw new NullPointerException("style cannot be null");
  if (!(style instanceof TextButtonStyle)) throw new IllegalArgumentException("style must be a TextButtonStyle.");
  super.setStyle(style);
  this.style = (TextButtonStyle)style;
  if (label != null) {
    TextButtonStyle textButtonStyle = (TextButtonStyle)style;
    LabelStyle labelStyle = label.getStyle();
    labelStyle.font = textButtonStyle.font;
    labelStyle.fontColor = textButtonStyle.fontColor;
    label.setStyle(labelStyle);
  }
}

代码示例来源:origin: libgdx/libgdx

public void setStyle (TextTooltipStyle style) {
  if (style == null) throw new NullPointerException("style cannot be null");
  if (!(style instanceof TextTooltipStyle)) throw new IllegalArgumentException("style must be a TextTooltipStyle.");
  container.getActor().setStyle(style.label);
  container.setBackground(style.background);
  container.maxWidth(style.wrapWidth);
}

代码示例来源:origin: libgdx/libgdx

public void setStyle (TextTooltipStyle style) {
  if (style == null) throw new NullPointerException("style cannot be null");
  if (!(style instanceof TextTooltipStyle)) throw new IllegalArgumentException("style must be a TextTooltipStyle.");
  container.getActor().setStyle(style.label);
  container.setBackground(style.background);
  container.maxWidth(style.wrapWidth);
}

代码示例来源:origin: libgdx/libgdx

public void setStyle (WindowStyle style) {
  if (style == null) throw new IllegalArgumentException("style cannot be null.");
  this.style = style;
  setBackground(style.background);
  titleLabel.setStyle(new LabelStyle(style.titleFont, style.titleFontColor));
  invalidateHierarchy();
}

代码示例来源:origin: libgdx/libgdx

public void setStyle (WindowStyle style) {
  if (style == null) throw new IllegalArgumentException("style cannot be null.");
  this.style = style;
  setBackground(style.background);
  titleLabel.setStyle(new LabelStyle(style.titleFont, style.titleFontColor));
  invalidateHierarchy();
}

代码示例来源:origin: libgdx/libgdx

public void setStyle (ButtonStyle style) {
  if (!(style instanceof ImageTextButtonStyle)) throw new IllegalArgumentException("style must be a ImageTextButtonStyle.");
  super.setStyle(style);
  this.style = (ImageTextButtonStyle)style;
  if (image != null) updateImage();
  if (label != null) {
    ImageTextButtonStyle textButtonStyle = (ImageTextButtonStyle)style;
    LabelStyle labelStyle = label.getStyle();
    labelStyle.font = textButtonStyle.font;
    labelStyle.fontColor = textButtonStyle.fontColor;
    label.setStyle(labelStyle);
  }
}

代码示例来源:origin: libgdx/libgdx

public void setStyle (ButtonStyle style) {
  if (!(style instanceof ImageTextButtonStyle)) throw new IllegalArgumentException("style must be a ImageTextButtonStyle.");
  super.setStyle(style);
  this.style = (ImageTextButtonStyle)style;
  if (image != null) updateImage();
  if (label != null) {
    ImageTextButtonStyle textButtonStyle = (ImageTextButtonStyle)style;
    LabelStyle labelStyle = label.getStyle();
    labelStyle.font = textButtonStyle.font;
    labelStyle.fontColor = textButtonStyle.fontColor;
    label.setStyle(labelStyle);
  }
}

代码示例来源:origin: libgdx/libgdx

public Label (CharSequence text, LabelStyle style) {
  if (text != null) this.text.append(text);
  setStyle(style);
  if (text != null && text.length() > 0) setSize(getPrefWidth(), getPrefHeight());
}

代码示例来源:origin: libgdx/libgdx

public Label (CharSequence text, LabelStyle style) {
  if (text != null) this.text.append(text);
  setStyle(style);
  if (text != null && text.length() > 0) setSize(getPrefWidth(), getPrefHeight());
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

public void setStyle (ButtonStyle style) {
  if (style == null) throw new NullPointerException("style cannot be null");
  if (!(style instanceof TextButtonStyle)) throw new IllegalArgumentException("style must be a TextButtonStyle.");
  super.setStyle(style);
  this.style = (TextButtonStyle)style;
  if (label != null) {
    TextButtonStyle textButtonStyle = (TextButtonStyle)style;
    LabelStyle labelStyle = label.getStyle();
    labelStyle.font = textButtonStyle.font;
    labelStyle.fontColor = textButtonStyle.fontColor;
    label.setStyle(labelStyle);
  }
}

代码示例来源:origin: kotcrab/vis-ui

@Override
public void setStyle (ButtonStyle style) {
  if (!(style instanceof MenuItemStyle)) throw new IllegalArgumentException("style must be a MenuItemStyle.");
  super.setStyle(style);
  this.style = (MenuItemStyle) style;
  if (label != null) {
    TextButtonStyle textButtonStyle = (TextButtonStyle) style;
    LabelStyle labelStyle = label.getStyle();
    labelStyle.font = textButtonStyle.font;
    labelStyle.fontColor = textButtonStyle.fontColor;
    label.setStyle(labelStyle);
  }
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

public void setStyle (TextTooltipStyle style) {
  if (style == null) throw new NullPointerException("style cannot be null");
  if (!(style instanceof TextTooltipStyle)) throw new IllegalArgumentException("style must be a TextTooltipStyle.");
  container.getActor().setStyle(style.label);
  container.setBackground(style.background);
  container.maxWidth(style.wrapWidth);
}

代码示例来源:origin: 121077313/cocostudio-ui-libgdx

@Override
public void setStyle(LabelStyle style) {
  style.font = createFont((TTFLabelStyle) style, "" + getText());
  super.setStyle(style);
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

public void setStyle (WindowStyle style) {
  if (style == null) throw new IllegalArgumentException("style cannot be null.");
  this.style = style;
  setBackground(style.background);
  titleLabel.setStyle(new LabelStyle(style.titleFont, style.titleFontColor));
  invalidateHierarchy();
}

代码示例来源:origin: com.github.xaguzman/gamedevlib-libgdx

public void setStyle (TitleBarWindowStyle style) {
  if (style == null) throw new IllegalArgumentException("style cannot be null.");
  this.style = style;
  setBackground(style.background);
  titleLabel.setStyle(new Label.LabelStyle(style.titleFont, style.titleFontColor));
  invalidateHierarchy();
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

public Label (CharSequence text, LabelStyle style) {
  if (text != null) this.text.append(text);
  setStyle(style);
  if (text != null && text.length() > 0) setSize(getPrefWidth(), getPrefHeight());
}

代码示例来源:origin: 121077313/cocostudio-ui-libgdx

@Override
public void setText(CharSequence newText) {
  LabelStyle style = getStyle();
  style.font = createFont((TTFLabelStyle) style, "" + newText);
  super.setStyle(style);
  super.setText(newText);
}

代码示例来源:origin: langurmonkey/gaiasky

public void setStyle(TextTooltipStyle style) {
  if (style == null)
    throw new NullPointerException("style cannot be null");
  if (!(style instanceof TextTooltipStyle))
    throw new IllegalArgumentException("style must be a TextTooltipStyle.");
  getContainer().getActor().setStyle(style.label);
  getContainer().setBackground(style.background);
  getContainer().maxWidth(style.wrapWidth);
}

代码示例来源:origin: peakgames/libgdx-stagebuilder

public static void setLineHeight(Label label, float height) {
  BitmapFont font = label.getStyle().font;
  BitmapFont.BitmapFontData copiedData = new BitmapFont.BitmapFontData(font.getData().fontFile, font.getData().flipped);
  copiedData.setLineHeight(height);
  Label.LabelStyle style = new Label.LabelStyle(new BitmapFont(copiedData, font.getRegion(), true), new Color(font.getColor()));
  label.setStyle(style);
}

相关文章