Package java.awt.font

Examples of java.awt.font.TextLayout.draw()


        Font oldFont = g.getFont();
//        if (!color.equals(Color.BLACK)) {
//            g.setFont(g.getFont().deriveFont(Font.BOLD));
//        }
        TextLayout tl = new TextLayout(getCaption(), g.getFont(), g.getFontRenderContext());
        tl.draw(g, x, y);
        g.setFont(oldFont);
    }

   private String getCaption()
   {
View Full Code Here


            // Calculate the position for the text
            Rectangle2D bounds = txt.getBounds();
            int xpos = startx + ((int)(columnWidth - bounds.getWidth()))/2 - (int)bounds.getMinX();
            g2.clearRect( xpos-2, ypos-2,
                    (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 );
            txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) );
            ypos += bounds.getHeight() + 4;
        }
        String shootPlace = photo.getShootingPlace();
        if ( showPlace && shootPlace != null && shootPlace.length() > ) {
            TextLayout txt = new TextLayout( photo.getShootingPlace(), attrFont, frc );
View Full Code Here

            Rectangle2D bounds = txt.getBounds();
            int xpos = startx + ((int)(columnWidth-bounds.getWidth()))/2 - (int)bounds.getMinX();
           
            g2.clearRect( xpos-2, ypos-2,
                    (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 );
            txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) );
            ypos += bounds.getHeight() + 4;
        }
        g2.setBackground( prevBkg );
        txw.commit();
       
View Full Code Here

            tx = -advance/2;
            break;
        case TextNode.Anchor.ANCHOR_END:
            tx = -advance;
        }
        layout.draw(g2d, (float)(location.getX() + tx), (float)(location.getY()));
    }

}
View Full Code Here

        float posX = (float) border;
        float posY = (float) border;
        for (int i = 0; i < paragraphs.length; ++i) {
            layout = new TextLayout(paragraphs[i], font, frc);
            posY += layout.getAscent();
            layout.draw(graphics, posX, posY);
            posY += layout.getDescent() + layout.getLeading();
        }

        return bi;
    }
View Full Code Here

        textY += tl.getAscent();
        Rectangle2D bb = tl.getBounds();
        int tX = (int) graphicInfo.getX();
        if (centered)
            tX += (int) (graphicInfo.getWidth() / 2 - bb.getWidth() / 2);
        tl.draw(g, tX, textY);
        textY += tl.getDescent() + tl.getLeading() + (interline - 1.0f) * tl.getAscent();
      }
 
      // restore originals
      g.setFont(originalFont);
View Full Code Here

                     drawPosX = this.getLeft() + ( this.getWidth() - layout.getAdvance() )/2 ;
                
                 // draw the outline
                 if (this.getFontOutline() > 0.1f){
                     g.setColor(outlineColor);
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop());
                     layout.draw(g, drawPosX - this.getFontOutline(), drawPosY + this.getTop());
                     layout.draw(g, drawPosX, drawPosY + this.getTop() + this.getFontOutline());
                     layout.draw(g, drawPosX, drawPosY + this.getTop() - this.getFontOutline());
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop() + this.getFontOutline());
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop() - this.getFontOutline());
View Full Code Here

                
                 // draw the outline
                 if (this.getFontOutline() > 0.1f){
                     g.setColor(outlineColor);
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop());
                     layout.draw(g, drawPosX - this.getFontOutline(), drawPosY + this.getTop());
                     layout.draw(g, drawPosX, drawPosY + this.getTop() + this.getFontOutline());
                     layout.draw(g, drawPosX, drawPosY + this.getTop() - this.getFontOutline());
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop() + this.getFontOutline());
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop() - this.getFontOutline());
                     layout.draw(g, drawPosX - this.getFontOutline(), drawPosY + this.getTop() + this.getFontOutline());
View Full Code Here

                 // draw the outline
                 if (this.getFontOutline() > 0.1f){
                     g.setColor(outlineColor);
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop());
                     layout.draw(g, drawPosX - this.getFontOutline(), drawPosY + this.getTop());
                     layout.draw(g, drawPosX, drawPosY + this.getTop() + this.getFontOutline());
                     layout.draw(g, drawPosX, drawPosY + this.getTop() - this.getFontOutline());
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop() + this.getFontOutline());
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop() - this.getFontOutline());
                     layout.draw(g, drawPosX - this.getFontOutline(), drawPosY + this.getTop() + this.getFontOutline());
                     layout.draw(g, drawPosX - this.getFontOutline(), drawPosY + this.getTop() - this.getFontOutline());
View Full Code Here

                 if (this.getFontOutline() > 0.1f){
                     g.setColor(outlineColor);
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop());
                     layout.draw(g, drawPosX - this.getFontOutline(), drawPosY + this.getTop());
                     layout.draw(g, drawPosX, drawPosY + this.getTop() + this.getFontOutline());
                     layout.draw(g, drawPosX, drawPosY + this.getTop() - this.getFontOutline());
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop() + this.getFontOutline());
                     layout.draw(g, drawPosX + this.getFontOutline(), drawPosY + this.getTop() - this.getFontOutline());
                     layout.draw(g, drawPosX - this.getFontOutline(), drawPosY + this.getTop() + this.getFontOutline());
                     layout.draw(g, drawPosX - this.getFontOutline(), drawPosY + this.getTop() - this.getFontOutline());
                 }
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.