Examples of LineMetrics


Examples of java.awt.font.LineMetrics

        return new Dimensions(preferredWidth, preferredHeight);
    }

    @Override
    public int getBaseline(int width, int height) {
        LineMetrics lm = font.getLineMetrics("", FONT_RENDER_CONTEXT);
        float ascent = lm.getAscent();

        float textHeight;
        if (wrapText) {
            textHeight = Math.max(getPreferredHeight(width) - (padding.top + padding.bottom), 0);
        } else {
            textHeight = (int)Math.ceil(lm.getHeight());
        }

        int baseline = -1;
        switch (verticalAlignment) {
            case TOP: {
View Full Code Here

Examples of java.awt.font.LineMetrics

            if (FONT_RENDER_CONTEXT.usesFractionalMetrics()) {
                graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
                    RenderingHints.VALUE_FRACTIONALMETRICS_ON);
            }

            LineMetrics lm = font.getLineMetrics("", FONT_RENDER_CONTEXT);
            float ascent = lm.getAscent();
            float lineHeight = lm.getHeight();

            float y = 0;
            switch (verticalAlignment) {
                case TOP: {
                    y = padding.top;
View Full Code Here

Examples of java.awt.font.LineMetrics

        if (title != null
            && title.length() > 0) {
            Rectangle2D headingBounds = font.getStringBounds(title, fontRenderContext);
            preferredWidth = (int)Math.ceil(headingBounds.getWidth());

            LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
            topThickness = Math.max((int)Math.ceil(lm.getHeight()), topThickness);
        }

        Component content = border.getContent();
        if (content != null) {
            if (height != -1) {
View Full Code Here

Examples of java.awt.font.LineMetrics

        int topThickness = thickness;

        String title = border.getTitle();
        if (title != null
            && title.length() > 0) {
            LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
            topThickness = Math.max((int)Math.ceil(lm.getHeight()), topThickness);
        }

        Component content = border.getContent();
        if (content != null) {
            if (width != -1) {
View Full Code Here

Examples of java.awt.font.LineMetrics

        Component content = border.getContent();
        if (content != null) {
            String title = border.getTitle();
            if (title != null
                && title.length() > 0) {
                LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
                topThickness = Math.max((int)Math.ceil(lm.getHeight()), topThickness);
            }

            int clientWidth = Math.max(width - (thickness * 2)
                - (padding.left + padding.right), 0);
            int clientHeight = Math.max(height - (topThickness + thickness) -
View Full Code Here

Examples of java.awt.font.LineMetrics

        int topThickness = thickness;

        String title = border.getTitle();
        if (title != null
            && title.length() > 0) {
            LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
            topThickness = Math.max((int)Math.ceil(lm.getHeight()), topThickness);
        }

        Component content = border.getContent();
        if (content != null) {
            content.setLocation(padding.left + thickness,
View Full Code Here

Examples of java.awt.font.LineMetrics

        float titleAscent = 0;

        String title = border.getTitle();
        if (title != null
            && title.length() > 0) {
            LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
            titleAscent = lm.getAscent();
            topThickness = Math.max((int)Math.ceil(lm.getHeight()), topThickness);
        }

        // TODO Java2D doesn't support variable corner radii; we'll need to
        // "fake" this by drawing multiple arcs
        int cornerRadius = cornerRadii.topLeft;
View Full Code Here

Examples of java.awt.font.LineMetrics

        return new Dimensions(preferredWidth, preferredHeight);
    }

    @Override
    public int getBaseline(int width, int height) {
        LineMetrics lm = font.getLineMetrics("", FONT_RENDER_CONTEXT);
        float ascent = lm.getAscent();
        return margin.top + Math.round(ascent);
    }
View Full Code Here

Examples of java.awt.font.LineMetrics

        return new Dimensions(getPreferredWidth(-1), getPreferredHeight(-1));
    }

    @Override
    public int getBaseline(int width, int height) {
        LineMetrics lm = font.getLineMetrics("", FONT_RENDER_CONTEXT);
        float ascent = lm.getAscent();
        float textHeight = lm.getHeight();

        int baseline = Math.round((height - textHeight) / 2 + ascent);

        return baseline;
    }
View Full Code Here

Examples of java.awt.font.LineMetrics

        if (FONT_RENDER_CONTEXT.usesFractionalMetrics()) {
            graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
                RenderingHints.VALUE_FRACTIONALMETRICS_ON);
        }

        LineMetrics lm = font.getLineMetrics("", FONT_RENDER_CONTEXT);
        float ascent = lm.getAscent();
        float textHeight = lm.getHeight();

        String prompt = textInput.getPrompt();

        if (glyphVector == null
            && prompt != null
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.