Esempio n. 1
0
  public void load(IMemento memento) {
    text = memento.getString(LABEL_KEY);
    horizontalAlignment = memento.getInteger(HORIZ_ALIGN_KEY);
    setScaleFactor(memento.getFloat(FONT_SCALE_FACTOR));
    String family = memento.getString(FONT_NAME_KEY);
    if (family != null) {
      int size = memento.getInteger(SIZE_KEY);
      int style = memento.getInteger(STYLE_KEY);
      originalFont = new Font(family, style, size);
      int resizedValue = (int) ((float) size * getScaleFactor());
      if (resizedValue < 4) {
        resizedValue = 4;
      }
      scaledFont = new Font(family, style, resizedValue);

      String colorString = memento.getString(FONT_COLOR_KEY);
      if (colorString != null) {
        String[] colorSplit = colorString.split(",");
        Color clr =
            new Color(
                Integer.parseInt(colorSplit[0]),
                Integer.parseInt(colorSplit[1]),
                Integer.parseInt(colorSplit[2]));
        fontColor = clr;
      }
    }
  }
Esempio n. 2
0
 public void restoreState(IMemento memento) {
   frame.offsetX = memento.getFloat("frameOffsetX");
   frame.offsetY = memento.getFloat("frameOffsetY");
   frame.scale = memento.getFloat("frameScale");
 }