Package com.sun.dtv.lwuit

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


        int dayHeight = (ch / 6);

        long sd = cal.getSelectedDay();
        Date date = new Date();

        int fix = f.stringWidth("22") / 2;


        g.setColor(mv.getStyle().getBgSelectionColor());
        g.fillRect(mv.getX() + 2, mv.getY() + 2, mv.getWidth() - 4, mv.getStyle().getFont().getHeight());
View Full Code Here


        if (text != null && text.length() > 0) {
            //add the text size
            switch (l.getTextPosition()) {
                case Label.LEFT:
                case Label.RIGHT:
                    prefW += font.stringWidth(text);
                    prefH = Math.max(prefH, font.getHeight());
                    break;
                case Label.BOTTOM:
                case Label.TOP:
                    prefW = Math.max(prefW, font.stringWidth(text));
View Full Code Here

                    prefW += font.stringWidth(text);
                    prefH = Math.max(prefH, font.getHeight());
                    break;
                case Label.BOTTOM:
                case Label.TOP:
                    prefW = Math.max(prefW, font.stringWidth(text));
                    prefH += font.getHeight();
                    break;
            }
        }
        //add the state image(relevant for CheckBox\RadioButton)
View Full Code Here

     * @inheritDoc
     */
    public Dimension getMonthViewPreferredSize(Component mv) {
        Font f = mv.getStyle().getFont();
        int fh = f.getHeight();
        int dayWidth = f.stringWidth("22");

        int w = (dayWidth + DAY_SPACE_W) * 7;
        int h = (fh + DAY_SPACE_H) * 5;

        return new Dimension(w + mv.getStyle().getPadding(Component.RIGHT) + mv.getStyle().getPadding(Component.LEFT), h + mv.getStyle().getPadding(Component.TOP) + mv.getStyle().getPadding(Component.BOTTOM));
View Full Code Here

        int prefH = 0;
        Font f = ta.getStyle().getFont();

        //if this is a text field the preferred size should be the text width
        if (ta.getRows() == 1) {
            prefW = f.stringWidth(ta.getText());
        } else {
            prefW = f.stringWidth("W") * ta.getColumns();
        }
        int rows = ta.getRows();
        prefH = (f.getHeight() + 2) * rows;
 
View Full Code Here

        //if this is a text field the preferred size should be the text width
        if (ta.getRows() == 1) {
            prefW = f.stringWidth(ta.getText());
        } else {
            prefW = f.stringWidth("W") * ta.getColumns();
        }
        int rows = ta.getRows();
        prefH = (f.getHeight() + 2) * rows;
        int columns = ta.getColumns();
        String str = "";
View Full Code Here

        int columns = ta.getColumns();
        String str = "";
        for (int iter = 0; iter < columns; iter++) {
            str += 'W';
        }
        prefW = Math.max(prefW, f.stringWidth(str));
        prefH = Math.max(prefH, rows * f.getHeight());

        return new Dimension(prefW + ta.getStyle().getPadding(Component.RIGHT) + ta.getStyle().getPadding(Component.LEFT), prefH + ta.getStyle().getPadding(Component.TOP) + ta.getStyle().getPadding(Component.BOTTOM));
    }

View Full Code Here

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

                case Label.BOTTOM:
                case Label.TOP:
                    x = x + (l.getWidth() - (preserveSpaceForState + style.getPadding(Component.LEFT) +
                            style.getPadding(Component.RIGHT) +
                            Math.max(((icon != null) ? icon.getWidth() : 0),
                            font.stringWidth(text)))) / 2;
                    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;
View Full Code Here

            switch (l.getTextPosition()) {
                case Label.LEFT:
                case Label.RIGHT:
                    x = l.getX() + l.getWidth() - style.getPadding(Component.RIGHT) -
                            (preserveSpaceForState + ((icon != null) ? (icon.getWidth() + gap) : 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) +
                            Math.max(((icon != null) ? icon.getHeight() : 0),
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.