Package com.sun.dtv.lwuit

Examples of com.sun.dtv.lwuit.Font.stringWidth()


                    break;
                case Label.BOTTOM:
                case Label.TOP:
                    x = l.getX() + l.getWidth() - style.getPadding(Component.RIGHT) -
                            preserveSpaceForState - (Math.max(((icon != null) ? (icon.getWidth()) : 0),
                            font.stringWidth(text)));
                    x = Math.max(x, l.getX() + style.getPadding(Component.LEFT) + preserveSpaceForState);
                    y = y + (l.getHeight() - (style.getPadding(Component.TOP) +
                            style.getPadding(Component.BOTTOM) +
                            ((icon != null) ? icon.getHeight() + gap : 0) + fontHeight)) / 2;
                    break;
View Full Code Here


    protected int drawLabelText(Graphics g, Label l, String text, int x, int y, int textSpaceW) {

        Font f = l.getStyle().getFont();
        if (!l.isTickerRunning()) {
            int txtW = f.stringWidth(text);
            //if there is no space to draw the text add ... at the end
            if (txtW > textSpaceW && textSpaceW > 0) {
                if (l.isEndsWith3Points()) {
                    String points = "...";
                    int index = 1;
View Full Code Here

            if (txtW > textSpaceW && textSpaceW > 0) {
                if (l.isEndsWith3Points()) {
                    String points = "...";
                    int index = 1;
                    String tmp = text.substring(0, index);
                    int pointsW = f.stringWidth(points);
                    while (f.stringWidth(tmp) + pointsW < textSpaceW) {
                        index++;
                        if (index >= text.length()) {
                            break;
                        }
View Full Code Here

                if (l.isEndsWith3Points()) {
                    String points = "...";
                    int index = 1;
                    String tmp = text.substring(0, index);
                    int pointsW = f.stringWidth(points);
                    while (f.stringWidth(tmp) + pointsW < textSpaceW) {
                        index++;
                        if (index >= text.length()) {
                            break;
                        }
                        tmp = text.substring(0, index);
View Full Code Here

               
            }
        }

        g.drawString(text, l.getShiftText() + x, y);
        return Math.min(f.stringWidth(text), textSpaceW);
    }

    private Image getIconFromState(Button b) {
        Image icon = null;
        switch (b.getState()) {
View Full Code Here

        int cursorCharPosition = ta.getCursorPosition();
        Font f = ta.getStyle().getFont();
        int cursorX = 0;
        int xPos = 0;
        if (cursorCharPosition > 0) {
            xPos = f.stringWidth(ta.getText().substring(0, cursorCharPosition));
            cursorX = ta.getX() + style.getPadding(Component.LEFT) + xPos;
            if (ta.getWidth() > (f.getHeight() * 2) && cursorX >= ta.getWidth() - f.getHeight()) {
                while (x + xPos >= ta.getWidth() - f.getHeight() * 2) {
                    x--;
                }
View Full Code Here

        g.drawString(displayText, ta.getX() + x + style.getPadding(Component.LEFT),
                ta.getY() + style.getPadding(Component.TOP));

        String inputMode = ta.getInputMode();
        int inputModeWidth = f.stringWidth(inputMode);
        if (ta.handlesInput() && ta.getWidth() / 2 > inputModeWidth) {
            int drawXPos = ta.getX() + style.getPadding(Component.LEFT);
            if (xPos < ta.getWidth() / 2) {
                // draw on the right side
                drawXPos = drawXPos + ta.getWidth() - inputModeWidth - style.getPadding(Component.RIGHT) - style.getPadding(Component.LEFT);
View Full Code Here

        String displayText = getTextFieldString(ta);
       
        int xPos = 0;
        int cursorCharPosition = ta.getCursorPosition();
        if (cursorCharPosition > 0) {
            xPos = f.stringWidth(displayText.substring(0, cursorCharPosition));
        }
        int cursorX = ta.getX() + style.getPadding(Component.LEFT) + xPos;
        int cursorY = ta.getY() + style.getPadding(Component.TOP);
        int x = 0;
        if (ta.getWidth() > (f.getHeight() * 2) && cursorX >= ta.getWidth() - f.getHeight()) {
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.