Package com.sun.dtv.lwuit.plaf

Examples of com.sun.dtv.lwuit.plaf.Style


    Label(String text, String uiid) {
        this.text = text;
        localize();
        setFocusable(false);
        id = uiid;
        Style s = UIManager.getInstance().getComponentStyle(uiid);
        s.setBgPainter(getStyle().getBgPainter());
        setStyle(s);
        setAlignment(CENTER);
    }
View Full Code Here


                    g.translate(0, transY);
                } else {
                    painter.paint(g, new Rectangle(x, y, width, height));
                }
            } else {
                Style s = getStyle();
                int x = rect.getX();
                int y = rect.getY();
                int width = rect.getSize().getWidth();
                int height = rect.getSize().getHeight();
                if (width <= 0 || height <= 0) {
                    return;
                }
                Image bgImage = s.getBgImage();
                if (bgImage == null) {
                    if (hasFocus() && isFocusPainted()) {
                        g.setColor(s.getBgSelectionColor());
                        g.fillRect(x, y, width, height, s.getBgTransparency());
                    } else {
                        g.setColor(s.getBgColor());
                        g.fillRect(x, y, width, height, s.getBgTransparency());
                    }
                } else {
                    if (getStyle().isScaleImage()) {
                        if (bgImage.getWidth() != width || bgImage.getHeight() != height) {
                            bgImage = bgImage.scaled(width, height);
                            s.setBgImage(bgImage, true);
                        }
                    } else {
                        int iW = bgImage.getWidth();
                        int iH = bgImage.getHeight();
                        for (int xPos = 0; xPos < width; xPos += iW) {
                            for (int yPos = 0; yPos < height; yPos += iH) {
                                g.drawImage(s.getBgImage(), x + xPos, y + yPos);
                            }
                        }
                        return;
                    }
                    g.drawImage(s.getBgImage(), x, y);
                }
            }
        }
View Full Code Here

   
    /**
     * @inheritDoc
     */
    public void paint(Graphics g, Rectangle rect) {
        Style s = parent.getStyle();
        int x = rect.getX();
        int y = rect.getY();
        int width = rect.getSize().getWidth();
        int height = rect.getSize().getHeight();
        if (width <= 0 || height <= 0) {
            return;
        }
        Image bgImage = s.getBgImage();
        if (bgImage == null) {
            if (parent.hasFocus() && parent.isFocusPainted()) {
                g.setColor(s.getBgSelectionColor());
                g.fillRect(x, y, width, height, s.getBgTransparency());
            } else {
                g.setColor(s.getBgColor());
                g.fillRect(x, y, width, height, s.getBgTransparency());
            }
        } else {
            if (s.isScaleImage()) {
                if (bgImage.getWidth() != width || bgImage.getHeight() != height) {
                    bgImage = bgImage.scaled(width, height);
                    s.setBgImage(bgImage, true);
                }
            } else {
                int iW = bgImage.getWidth();
                int iH = bgImage.getHeight();
                for(int xPos = 0 ; xPos < width ; xPos += iW) {
                    for(int yPos = 0 ; yPos < height ; yPos += iH) {
                        g.drawImage(s.getBgImage(), x + xPos, y + yPos);
                    }
                }
                return;
            }
            g.drawImage(s.getBgImage(), x, y);
        }
    }
View Full Code Here

        }
        if (text == null || text.equals("")) {
            return;
        }

        Style style = getStyle();
        Font font = style.getFont();
        int charWidth = font.charWidth('W');
        int textAreaWidth = getWidth() - style.getPadding(RIGHT) - style.getPadding(LEFT) - style.getMargin(RIGHT) - style.getMargin(LEFT); //(border(=gap) + gap )*2
        if (textAreaWidth <= 0) {
            textAreaWidth = Math.min(10, columns) * charWidth;
        }
        int minCharactersInRow = Math.max(1, textAreaWidth / charWidth);
        int from = 0;
View Full Code Here

        themeMap.put("TextArea.fgColor", "FFFFFF");
        themeMap.put("List.bgColor", "000000");
        themeMap.put("List.fgColor", "FFFFFF");
        UIManager.getInstance().setThemeProps(themeMap);

        style = new Style();
        style.setBgTransparency(0);
    }
View Full Code Here

            for (int i=0;i<arquivos.length;i++)
                list.addItem(arquivos[i]);
        }
        list.setY(15);
        list.setHeight(10);
        Style stylebotao = new Style();
        stylebotao.setBgColor(0x000000, true);
        stylebotao.setBgSelectionColor(0x090909, true);
        list.setStyle(stylebotao);

        final Button btnLoadXlet = new Button("Carregar >>");
        btnLoadXlet.setY(143);
        btnLoadXlet.setX(160);
View Full Code Here

            }
        }
        list.setY(15);
        list.setHeight(10);
        list.setHandlesInput(true);
        Style stylebotao = new Style();
        stylebotao.setBgColor(0x000000, true);
        stylebotao.setBgSelectionColor(0x090909, true);
        list.setStyle(stylebotao);

        final Button btnLoadXlet = new Button("Carregar >>");
        btnLoadXlet.setY(143);
        btnLoadXlet.setX(160);
View Full Code Here

            updateSoftButtonStyle(b);
            return b;
        }

        private void updateSoftButtonStyle(Button b) {
            Style s = new Style(getStyle());
            b.setStyle(s);
            s.setBgImage(null);
            s.setBorder(null);
            s.setMargin(2, 2, 2, 2);
            s.setPadding(2, 2, 2, 2);
            s.setBgTransparency(0);
        }
View Full Code Here

        popupContent.setHeight(height);
        popupContent.setX(getAbsoluteX());
        popupContent.setY(y);
        popupContent.setWidth(getWidth());
        popupContent.setFixedPosition(true);
        Style s = popupContent.getStyle();
        s.merge(getStyle());
        s.setBgTransparency(0xFF);
        s.setBorder(null);
        s.setMargin(0, 0, 0, 0);
        s.setPadding(0, 0, 0, 0);
        return popup;
    }
View Full Code Here

    /**
     * Calculates the desired bounds for the component and returns them within the
     * given rectangle.
     */
    private void calculateComponentPosition(int index, int defaultWidth, Rectangle rect, Dimension rendererSize, Dimension selectedSize, boolean beforeSelected) {
        Style style = getStyle();
        int initialY = style.getPadding(TOP);
        int initialX = style.getPadding(LEFT);
        int selection = getSelectedIndex();
        Dimension d = rect.getSize();
        int selectedDiff;
       
        // the algorithm illustrated here is very simple despite the "mess" of code...
        // The idea is that if we have a "fixed" element we just add up the amount of pixels
        // to get it into its place in the screen (nothing for top obviously).
        // In order to cause the list to be cyclic we just subtract the list size
        // which will cause the bottom elements to "return" from the top.
        if (orientation == VERTICAL) {
            int height = rendererSize.getHeight();
            selectedDiff = selectedSize.getHeight() - height;
            rect.setX(initialX);
            d.setHeight(height);
            d.setWidth(defaultWidth);
            int y = 0;
            int listHeight = getHeight() - style.getPadding(TOP) - style.getPadding(BOTTOM);
            int totalHeight = (height + itemGap) * getModel().getSize() + selectedDiff;
            switch (fixedSelection) {
                case FIXED_CENTER:
                    y = listHeight / 2 - (height + itemGap+ selectedDiff) / 2 +
                            (index - selection) * (height + itemGap);
                    if(!beforeSelected){
                        y += selectedDiff;
                    }
                    y = recalcOffset(y, totalHeight, listHeight, height + itemGap);
                    break;
                case FIXED_TRAIL:
                    y = listHeight - (height + itemGap + selectedDiff);
                case FIXED_LEAD:
                    y += (index - selection) * (height + itemGap);
                    if(index - selection > 0){
                        y += selectedDiff;
                    }
                    y = recalcOffset(y, totalHeight, listHeight, height + itemGap);
                    break;
                default:
                    y = index * (height + itemGap);
                    if(!beforeSelected){
                        y += selectedDiff;
                    }
                    break;
            }
            rect.setY(y + initialY);
            if(index == selection){
                d.setHeight(d.getHeight() + selectedDiff);
            }
           
        } else {
            int width = rendererSize.getWidth();
            selectedDiff = selectedSize.getWidth() - width;
            rect.setY(initialY);
            d.setHeight(getHeight() - style.getPadding(TOP) - style.getPadding(BOTTOM));
            d.setWidth(width);
            int x = 0;
            int listWidth = getWidth() - style.getPadding(RIGHT) - style.getPadding(LEFT);
            int totalWidth = (width + itemGap) * getModel().getSize() + selectedDiff;
            switch (fixedSelection) {
                case FIXED_CENTER:
                    x = listWidth / 2 - (width + itemGap +selectedDiff) / 2 +
                            (index - selection) * (width + itemGap);
View Full Code Here

TOP

Related Classes of com.sun.dtv.lwuit.plaf.Style

Copyright © 2018 www.massapicom. 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.