コード例 #1
0
  public FontPropertiesManager(
      PropertiesManager appProps, Properties sysProps, ResourceBundle messageBundle) {
    this.sysProps = sysProps;
    this.props = appProps;
    this.fontProps = new Properties();
    this.messageBundle = messageBundle;
    // create a new Font Manager.
    this.fontManager = FontManager.getInstance();

    setupHomeDir(null);

    recordMofifTime();

    setupLock();

    loadProperties();
  }
コード例 #2
0
  public void setAppearanceStream() {
    // copy over annotation properties from the free text annotation.
    if (fontFile == null || freeTextAnnotation.isFontPropertyChanged()) {
      fontFile =
          FontManager.getInstance()
              .getType1AWTFont(freeTextAnnotation.getFontName(), freeTextAnnotation.getFontSize());
    }
    freeTextPane.setFont(fontFile);
    freeTextPane.setForeground(freeTextAnnotation.getFontColor());

    if (freeTextAnnotation.isFillType()) {
      freeTextPane.setOpaque(true);
      freeTextPane.setBackground(freeTextAnnotation.getFillColor());
    } else {
      freeTextPane.setOpaque(false);
    }
    if (freeTextAnnotation.isStrokeType()) {
      if (freeTextAnnotation.getBorderStyle().isStyleSolid()) {
        freeTextPane.setBorder(
            BorderFactory.createLineBorder(
                freeTextAnnotation.getColor(),
                (int) freeTextAnnotation.getBorderStyle().getStrokeWidth()));
      } else if (freeTextAnnotation.getBorderStyle().isStyleDashed()) {
        freeTextPane.setBorder(
            new DashedBorder(freeTextAnnotation.getBorderStyle(), freeTextAnnotation.getColor()));
      }
    } else {
      freeTextPane.setBorder(BorderFactory.createEmptyBorder());
    }

    String content = null;
    try {
      content = freeTextPane.getDocument().getText(0, freeTextPane.getDocument().getLength());
    } catch (BadLocationException e) {
      logger.warning("Error getting rich text.");
    }
    Rectangle tBbox = convertToPageSpace(getBounds());

    // generate the shapes
    freeTextAnnotation.setBBox(tBbox);
    freeTextAnnotation.setContents(content);
    freeTextAnnotation.setRichText(freeTextPane.getText());
    freeTextPane.revalidate();
  }