Examples of Font


Examples of java.awt.Font

  public void configureTextField(EditableLabelField field) {
    configureTextField(field, 1.0);
  }
 
  public void configureTextField(EditableLabelField field, double zoom) {
    Font f = font;
    if (zoom != 1.0) {
      f = f.deriveFont(AffineTransform.getScaleInstance(zoom, zoom));
    }
    field.setFont(f);
   
    Dimension dim = field.getPreferredSize();
    int w;
View Full Code Here

Examples of java.awt.Font

    if (text == null || text.equals("")) return;
   
    int halign = attrs.getHorizontalAlign();
    int valign = attrs.getVerticalAlign();
    Graphics g = painter.getGraphics();
    Font old = g.getFont();
    g.setFont(attrs.getFont());
    GraphicsUtil.drawText(g, text, 0, 0, halign, valign);
   
    String textTrim = text.endsWith(" ") ? text.substring(0, text.length() - 1) : text;
    Bounds newBds;
View Full Code Here

Examples of java.awt.Font

    enter.addActionListener(myListener);
    field.setLineWrap(true);
    field.setWrapStyleWord(true);
    field.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), myListener);
    field.getDocument().addDocumentListener(myListener);
    field.setFont(new Font("Monospaced", Font.PLAIN, 14));

    JPanel buttons = new JPanel();
    buttons.add(clear);
    buttons.add(revert);
    buttons.add(enter);
View Full Code Here

Examples of java.awt.Font

    }
    return Bounds.create(x, y - ascent, width, ascent + descent);
  }

  public void draw(Graphics g) {
    Font old = g.getFont();
    if (font != null) g.setFont(font);

    int x = this.x;
    int y = this.y;
    FontMetrics fm = g.getFontMetrics();
View Full Code Here

Examples of java.awt.Font

      Direction facing, Direction defaultFacing) {
    AttributeSet staticAttrs = source.getStaticAttributes();
    String label = staticAttrs.getValue(CircuitAttributes.CIRCUIT_LABEL_ATTR);
    if (label != null && !label.equals("")) {
      Direction up = staticAttrs.getValue(CircuitAttributes.CIRCUIT_LABEL_FACING_ATTR);
      Font font = staticAttrs.getValue(CircuitAttributes.CIRCUIT_LABEL_FONT_ATTR);

      int back = label.indexOf('\\');
      int lines = 1;
      boolean backs = false;
      while (back >= 0 && back <= label.length() - 2) {
View Full Code Here

Examples of java.awt.Font

  }
 
  public static Element createText(Document doc, Text text) {
    Element elt = doc.createElement("text");
    Location loc = text.getLocation();
    Font font = text.getValue(DrawAttr.FONT);
    Color fill = text.getValue(DrawAttr.FILL_COLOR);
    Object halign = text.getValue(DrawAttr.ALIGNMENT);
    elt.setAttribute("x", "" + loc.getX());
    elt.setAttribute("y", "" + loc.getY());
    if (!colorMatches(fill, Color.BLACK)) {
      elt.setAttribute("fill", getColorString(fill));
    }
    if (showOpacity(fill)) {
      elt.setAttribute("fill-opacity", getOpacityString(fill));
    }
    elt.setAttribute("font-family", font.getFamily());
    elt.setAttribute("font-size", "" + font.getSize());
    int style = font.getStyle();
    if ((style & Font.ITALIC) != 0) {
      elt.setAttribute("font-style", "italic");
    }
    if ((style & Font.BOLD) != 0) {
      elt.setAttribute("font-weight", "bold");
View Full Code Here

Examples of java.awt.Font

  @Override
  public void paintIconRectangular(InstancePainter painter) {
    Graphics g = painter.getGraphics();
    g.setColor(Color.black);
    g.drawRect(1, 2, 16, 16);
    Font old = g.getFont();
    g.setFont(old.deriveFont(9.0f));
    GraphicsUtil.drawCenteredText(g, "2k", 96);
    GraphicsUtil.drawCenteredText(g, "+1", 9, 13);
    g.setFont(old);
  }
View Full Code Here

Examples of java.awt.Font

                    ProgramFieldType.EPISODE_TYPE,
                    ProgramFieldType.ORIGIN_TYPE,
                    ProgramFieldType.PRODUCTION_YEAR_TYPE,
                    ProgramFieldType.SHORT_DESCRIPTION_TYPE
                  }, false),
              new Font("Dialog", Font.ITALIC, 12)
      ));

      return new QueueScheme[]{scheme};
    }
  }
View Full Code Here

Examples of java.awt.Font

    // correct Font
    if (html.indexOf("<html>") >= 0) {
      html = StringUtils.substringBetween(html, "<html>", "</html>");
    }
    JLabel label = new JLabel();
    Font font = label.getFont();
    html = "<html><div style=\"color:" + UiUtilities.getHTMLColorCode(label.getForeground())+";font-family:" + font.getName()
        + "; font-size:" + font.getSize() +";background-color:rgb(" + background.getRed() + "," + background.getGreen() + "," + background.getBlue() + ");\">" + html + "</div></html>";

    final JEditorPane pane = new JEditorPane("text/html", html);
    pane.setBorder(BorderFactory.createEmptyBorder());
    pane.setEditable(false);
    pane.setFont(font);
View Full Code Here

Examples of java.awt.Font

  /**
   * Set local FontMetrics from the <code>JTextArea</code>
   * Calls revalidate() and repaint()
   */
  private void setMetrics() {
    Font refFont = null;
  
    Document doc = this.textComponent.getDocument();
    if(doc instanceof DefaultStyledDocument) {
        DefaultStyledDocument myDoc = (DefaultStyledDocument)doc;
        refFont = myDoc.getFont(myDoc.getDefaultRootElement().getElement(0)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.