Package java.awt

Examples of java.awt.Font$FontAccessImpl


          ret.append(Integer.toHexString(color.getRed()));
          ret.append(Integer.toHexString(color.getGreen()));
          ret.append(Integer.toHexString(color.getBlue()));
          ret.append('m');
        }
        Font font = txt.getFont();
        if(font != null)
        {
          ret.append("<font face=\"" + font.getFontName() + "\" ");
          ret.append("size=\"" + font.getSize() + "\">");
        }
        ret.append(txt.getSequence());
      }
       else if(comp instanceof SmileyComponent)
       {
View Full Code Here


   */
  private static MessageComponent[] splitFontAndColor(TextComponent comp)
  {
    int currentFontStyle = Font.PLAIN;
    int currentFontSize = 10;
    Font currentFont = new Font(null, currentFontStyle, currentFontSize);
    Color currentColor = Color.black;

    List ret = new ArrayList();
    StringBuffer sb = new StringBuffer();
    sb.append(comp.getSequence());

    Matcher m = fontColorPattern.matcher(sb);
    int txtStart = 0;
    while(m.find())
    {
      int txtEnd = m.end();
      if(txtStart < txtEnd)
      {
        String text = sb.substring(txtStart, txtEnd);
        ret.add(new TextComponent(text, currentFont, currentColor));
      }
      txtStart = txtEnd;

      String fontFace = m.group(3);
      String fontSize = m.group(4);
      String colorCodeStr = m.group(7);
      String colorStr = m.group(9);

      if(fontFace != null)
        currentFont = new Font(fontFace, currentFontStyle, currentFontSize);
      if(fontSize != null)
      {
        currentFontSize = Integer.parseInt(fontSize);
        currentFont = currentFont.deriveFont((float)currentFontSize);
      }
      if(colorCodeStr != null)
      {
        switch(Integer.parseInt(colorCodeStr))
        {
View Full Code Here

  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

    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

    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

    }
    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

      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

  }
 
  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

  @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

                    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

TOP

Related Classes of java.awt.Font$FontAccessImpl

Copyright © 2018 www.massapicom. 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.