Package java.awt.font

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


                     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


                     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());
                 }

                 // draw the text
View Full Code Here

                     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());
                 }

                 // draw the text
                 g.setColor(fontColor);
View Full Code Here

                     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());
                 }

                 // draw the text
                 g.setColor(fontColor);
                 layout.draw(g, drawPosX, drawPosY + this.getTop());
View Full Code Here

                     layout.draw(g, drawPosX - this.getFontOutline(), drawPosY + this.getTop() - this.getFontOutline());
                 }

                 // draw the text
                 g.setColor(fontColor);
                 layout.draw(g, drawPosX, drawPosY + this.getTop());
                
                 drawPosY += layout.getDescent();
                 drawPosY += layout.getLeading();
             }
         }finally{
View Full Code Here

            {
              FontRenderContext context = g2.getFontRenderContext();
              TextLayout layout = new TextLayout(text, getFont(), context);
              Rectangle2D bounds = layout.getBounds();
              g2.setColor(getForeground());
              layout.draw(g2, (float) (width - bounds.getWidth()) / 2,
                          (float) (maxY + layout.getLeading() + 2 * layout.getAscent()));
            }
        }
    }

View Full Code Here

        Color c = new Color(255-color.getRed(), 255-color.getGreen(), 255-color.getBlue());
        if (gameOver || playerWon) {
            g2d.setColor(c);
            String t = gameOver ? brickbreacker.getString("GameView.0") : brickbreacker.getString("GameView.1"); //$NON-NLS-1$ //$NON-NLS-2$
            TextLayout tl = new TextLayout(t, f, g2d.getFontRenderContext());
            tl.draw(g2d, (float) (getWidth() - tl.getBounds().getWidth()) / 2,
                    gameOverY);
            g2d.setColor(oldC);
        }
        if(displayStartHelp){
            g2d.setColor(c);
View Full Code Here

        if(displayStartHelp){
            g2d.setColor(c);
            String text = MessageFormat.format(brickbreacker.getString("GameView.2")//$NON-NLS-1$
                    KeyEvent.getKeyText(brickbreacker.keyboardController.keyEject));
            TextLayout tl = new TextLayout(text, f, g2d.getFontRenderContext());
            tl.draw(g2d, (float) (getWidth() - tl.getBounds().getWidth()) / 2,
                    (float)(Pad.getInstance().getY() - 50));
            g2d.setColor(oldC);
        }
        if(isPaused()){
            g2d.setColor(c);
View Full Code Here

        }
        if(isPaused()){
            g2d.setColor(c);
            String text = brickbreacker.getString("GameView.3"); //$NON-NLS-1$
            TextLayout tl = new TextLayout(text, f, g2d.getFontRenderContext());
            tl.draw(g2d, (float) (getWidth() - tl.getBounds().getWidth()) / 2,
                    getHeight()/2);
            g2d.setColor(oldC);
        }
    }
   
View Full Code Here

        g2d.setFont(bigger);
        g2d.setColor(Color.BLACK);
        TextLayout tl = new TextLayout(playerStr, g2d.getFont(),
                g2d.getFontRenderContext());
        Rectangle2D r = tl.getBounds();
        tl.draw(g2d, (float) (getWidth() - r.getWidth()) / 2, yOffset);
    }

    private void drawLives(Graphics2D g2d, Font bigger, int yOffset) {
        int lives = game.getLives();
        g2d.setFont(bigger);
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.