Package com.sun.dtv.lwuit

Examples of com.sun.dtv.lwuit.Component


        int width = 0;
        int height = 0;

        int numOfcomponents = parent.getComponentCount();
        for(int i=0; i< numOfcomponents; i++){
            Component cmp = parent.getComponentAt(i);
           
            if(axis == Y_AXIS){
                height += cmp.getPreferredSize().getHeight()+ cmp.getStyle().getMargin(Component.TOP) + cmp.getStyle().getMargin(Component.BOTTOM);
                width = Math.max(width, cmp.getPreferredSize().getWidth());
            }else{
                height = Math.max(height, cmp.getPreferredSize().getHeight());
                width += cmp.getPreferredSize().getWidth()+ cmp.getStyle().getMargin(Component.LEFT) + cmp.getStyle().getMargin(Component.RIGHT);
            }
        }
        return new Dimension(width + parent.getStyle().getPadding(Component.LEFT)+ parent.getStyle().getPadding(Component.RIGHT),
        height + parent.getStyle().getPadding(Component.TOP)+ parent.getStyle().getPadding(Component.BOTTOM));
   
View Full Code Here


        int maxComponentWidth = width - parent.getStyle().getPadding(Component.LEFT);
        int maxComponentHeight = parent.getLayoutHeight() - y - parent.getStyle().getPadding(Component.BOTTOM);
       
        int numOfcomponents = parent.getComponentCount();
        for(int i=0; i< numOfcomponents; i++){
            Component cmp = parent.getComponentAt(i);
           
            int marginY = cmp.getStyle().getMargin(Component.TOP) + cmp.getStyle().getMargin(Component.BOTTOM);
            int marginX = cmp.getStyle().getMargin(Component.LEFT) + cmp.getStyle().getMargin(Component.RIGHT);
           
            cmp.setWidth(Math.min(maxComponentWidth - marginX, cmp.getPreferredSize().getWidth()));
            cmp.setHeight(Math.min(cmp.getPreferredSize().getHeight(), maxComponentHeight - marginY));
           
            if((x == parent.getStyle().getPadding(Component.LEFT)) || ( x+ cmp.getPreferredSize().getWidth() < width) )
            {
                cmp.setX(x + cmp.getStyle().getMargin(Component.LEFT));
                cmp.setY(y + cmp.getStyle().getMargin(Component.TOP));
               
                x += cmp.getPreferredSize().getWidth() + cmp.getStyle().getMargin(Component.RIGHT);
                rowH = Math.max(rowH, cmp.getPreferredSize().getHeight() + cmp.getStyle().getMargin(Component.TOP)+ cmp.getStyle().getMargin(Component.BOTTOM));
            } else {
                moveComponents(parent, parent.getStyle().getPadding(Component.LEFT), y, width - x, rowH, start, i);
                x = parent.getStyle().getPadding(Component.LEFT);
                y += rowH;
                cmp.setX(x + cmp.getStyle().getMargin(Component.LEFT));
                cmp.setY(y + cmp.getStyle().getMargin(Component.TOP));
                rowH = cmp.getPreferredSize().getHeight()+ cmp.getStyle().getMargin(Component.TOP)+ cmp.getStyle().getMargin(Component.BOTTOM);
                x += cmp.getPreferredSize().getWidth()+ cmp.getStyle().getMargin(Component.RIGHT);
                start = i;
               
            }
        }
        moveComponents(parent, parent.getStyle().getPadding(Component.LEFT), y, width - x, rowH, start, numOfcomponents);
View Full Code Here

            case Component.RIGHT:
                   x+=width;  // this will remove the last gap
                break;
        }
        for (int i = rowStart ; i < rowEnd ; i++) {
            Component m = target.getComponentAt(i);
           
            m.setX(m.getX()+ x + m.getStyle().getMargin(Component.LEFT));
            m.setY(y + m.getStyle().getMargin(Component.TOP) + (height - m.getPreferredSize().getHeight()) / 2);
           
        }
       
    }   
View Full Code Here

        int width = 0;
        int height = 0;
       
        int numOfcomponents = parent.getComponentCount();
        for(int i=0; i< numOfcomponents; i++){
            Component cmp = parent.getComponentAt(i);
            height = Math.max(height, cmp.getPreferredSize().getHeight() + cmp.getStyle().getMargin(Component.TOP)+ cmp.getStyle().getMargin(Component.BOTTOM));
            width += cmp.getPreferredSize().getWidth()+ cmp.getStyle().getMargin(Component.RIGHT)+ cmp.getStyle().getMargin(Component.LEFT);
        }
        return new Dimension(width + parent.getStyle().getPadding(Component.LEFT)+ parent.getStyle().getPadding(Component.RIGHT),
        height + parent.getStyle().getPadding(Component.TOP)+ parent.getStyle().getPadding(Component.BOTTOM));
       
    }
View Full Code Here

        firstFinished = false;
        if(transitionType == TYPE_EMPTY) {
            return;
        }
       
        Component source = getSource();
        Component destination = getDestination();
        position = 0;
        int w = source.getWidth();
        int h = source.getHeight();
        if (buffer == null) {
            buffer = Image.createImage(w, h);
View Full Code Here

    }

    private void paintAlpha(Graphics graphics) {
        // this will always be invoked on the EDT so there is no race condition risk
        if(rgbBuffer != null) {
            Component src = getSource();
            int w = src.getWidth();
            int h = src.getHeight();
            int position = this.position;
            if (position > 255) {
                position = 255;
            } else {
                if (position < 0) {
                    position = 0;
                }
            }
            int alpha = position << 24;
            int size = w * h;
            int[] bufferArray = rgbBuffer.getRGB();
            for (int iter = 0 ; iter < size ; iter++) {
                bufferArray[iter] = ((bufferArray[iter] & 0xFFFFFF) | alpha);
            }
            Component dest = getDestination();               
            int x = dest.getAbsoluteX();
            int y = dest.getAbsoluteY();
           
            graphics.setClip(x, y, w, h);
            graphics.drawImage(buffer, x, y);
            graphics.drawImage(rgbBuffer, x, y);
        }
View Full Code Here

        buffer = null;
        rgbBuffer = null;
    }

    private void paintSlideAtPosition(Graphics g, int slideX, int slideY) {
        Component source = getSource();
       
        // if this is the first form we can't do a slide transition since we have no source form
        if (source == null) {
            return;          
        }
       
        Component dest = getDestination();               
        int w = source.getWidth();
        int h = source.getHeight();
                   
        if (slideType == SLIDE_HORIZONTAL) {
            h = 0;
        } else {
            w = 0;
        }

        if(forward) {
            w = -w;
            h = -h;
        } else {
            slideX = -slideX;
            slideY = -slideY;
        }
        g.setClip(source.getAbsoluteX(), source.getAbsoluteY(), source.getWidth(), source.getHeight());
           
        // dialog animation is slightly different...
        if(source instanceof Dialog) {
            g.drawImage(buffer, 0, 0);
            paint(g, source, -slideX, -slideY);
            return;
        }
       
        if(dest instanceof Dialog) {
            g.drawImage(buffer, 0, 0);
            paint(g, dest, -slideX - w, -slideY - h);
            return;
        }
       
        g.setClip(source.getAbsoluteX(), source.getAbsoluteY(), source.getWidth(), source.getHeight());
      
        g.clipRect(dest.getAbsoluteX(), dest.getAbsoluteY(), source.getWidth(), source.getHeight());
        if(source.getParent() != null){
            source.paintBackgrounds(g);
            paint(g, source, slideX , slideY );
        }else{
            g.drawImage(buffer, slideX, slideY);       
View Full Code Here

                    dlg.getTitleComponent().paintComponent(g, false);
                    g.setClip(0, 0, cmp.getWidth(), cmp.getHeight());
                    dlg.getContentPane().paintComponent(g, false);
                    g.translate(-x, -y);
                    if(drawDialogMenu && dlg.getCommandCount() > 0) {
                        Component menuBar = dlg.getSoftButton(0).getParent();
                        g.setClip(0, 0, cmp.getWidth(), cmp.getHeight());
                        menuBar.paintComponent(g, false);
                    }

                    g.setClip(cx, cy, cw, ch);
                    cmp.getStyle().setBgPainter(p);
                    return;
View Full Code Here

            comboImageWidth = comboImage.getWidth();
        } else {
            comboImageWidth = style.getFont().getHeight();
        }
        if (model.getSize() > 0) {
            Component cmp = renderer.getListCellRendererComponent(cb, value, model.getSelectedIndex(), cb.hasFocus());
            cmp.setX(cb.getX() + leftPadding);
            cmp.setY(cb.getY() + style.getPadding(Component.TOP));
            cmp.setWidth(cb.getWidth() - comboImageWidth - 2 * rightPadding - leftPadding);
            cmp.setHeight(cb.getHeight() - style.getPadding(Component.TOP) - style.getPadding(Component.BOTTOM));
            cmp.paint(g);
        }

        g.setColor(style.getBgColor());
        int y = cb.getY();
        int height = cb.getHeight();
View Full Code Here

        ListModel model = l.getModel();
        int numOfcomponents = model.getSize();
        Object prototype = l.getRenderingPrototype();
        if(prototype != null) {
            ListCellRenderer renderer = l.getRenderer();
            Component cmp = renderer.getListCellRendererComponent(l, prototype, 0, false);
            height = cmp.getPreferredSize().getHeight();
            width = cmp.getPreferredSize().getWidth();
            cmp = renderer.getListCellRendererComponent(l, prototype, 0, true);

            selectedHeight = Math.max(height, cmp.getPreferredSize().getHeight());
            selectedWidth = Math.max(width, cmp.getPreferredSize().getWidth());
        } else {
            int hightCalcComponents = Math.min(5, numOfcomponents);
            ListCellRenderer renderer = l.getRenderer();
            for (int i = 0; i < hightCalcComponents; i++) {
                Object value = model.getItemAt(i);
                Component cmp = renderer.getListCellRendererComponent(l, value, i, false);

                height = Math.max(height, cmp.getPreferredSize().getHeight());
                width = Math.max(width, cmp.getPreferredSize().getWidth());
            }
            selectedHeight = height;
            selectedWidth = width;
            if (numOfcomponents > 0) {
                Object value = model.getItemAt(0);
                Component cmp = renderer.getListCellRendererComponent(l, value, 0, true);

                selectedHeight = Math.max(height, cmp.getPreferredSize().getHeight());
                selectedWidth = Math.max(width, cmp.getPreferredSize().getWidth());
            }
        }
        int verticalPadding = l.getStyle().getPadding(Component.TOP) + l.getStyle().getPadding(Component.BOTTOM);
        int horizontalPadding = l.getStyle().getPadding(Component.RIGHT) + l.getStyle().getPadding(Component.LEFT);
View Full Code Here

TOP

Related Classes of com.sun.dtv.lwuit.Component

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.