Package com.sun.dtv.lwuit

Examples of com.sun.dtv.lwuit.Component$BGPainter


        if (!vertical && !horizontal) {
            throw new IllegalArgumentException(
                    "Axis must contain HORIZONTAL or VERTICAL");
        }
        for (int counter = components.length - 1; counter >= 0; counter--) {
            Component c = components[counter];
            if (components[counter] == null) {
                throw new IllegalArgumentException(
                        "Components must be non-null");
            }
            // Force the component to be added
View Full Code Here


       
        // Step 4: apply the size to the components.
        Enumeration componentInfo = componentInfos.elements();
        while (componentInfo.hasMoreElements()) {
            ComponentInfo info = (ComponentInfo)componentInfo.nextElement();
            Component c = info.getComponent();
            info.setBounds(insetLeft, insetTop, width, ltr);
        }
    }
View Full Code Here

                if (areParallelSiblings(source.getComponent(),
                        spring.getComponent(), oAxis)) {
                    addValidTarget(source, spring);
                }
            } else {
                Component component = spring.getComponent();
                for (int counter = sources.size() - 1; counter >= 0; counter--){
                    ComponentSpring source = (ComponentSpring)sources.
                            elementAt(counter);
                    if (areParallelSiblings(source.getComponent(),
                            component, oAxis)) {
View Full Code Here

        int numOfcomponents = parent.getComponentCount();
        int parentW = parent.getWidth();
        int parentH = parent.getHeight();
       
        for(int i=0; i< numOfcomponents; i++){
            Component cmp = parent.getComponentAt(i);
            int x = cmp.getX() * parentW /width;
            int y = cmp.getY() * parentH /height;
            cmp.setX(x);
            cmp.setY(y);
           
            cmp.setWidth(cmp.getPreferredSize().getWidth());
            cmp.setHeight(cmp.getPreferredSize().getHeight());
        }
        width = parentW;
        height = parentH;
    }
View Full Code Here

     */
    public Dimension getPreferredSize(Container parent) {
        Dimension retVal = new Dimension();
        int numOfcomponents = parent.getComponentCount();
        for(int i=0; i< numOfcomponents; i++){
            Component cmp = parent.getComponentAt(i);
            retVal.setWidth(Math.max(retVal.getWidth(), cmp.getX() + cmp.getPreferredSize().getWidth()));
            retVal.setHeight(Math.max(retVal.getHeight(), cmp.getY() + cmp.getPreferredSize().getHeight()));
        }
       
        return retVal;
    }
View Full Code Here

        }

        int row = 0;       
       
        for(int i=0; i< numOfcomponents; i++){
            Component cmp = parent.getComponentAt(i);
            cmp.setWidth(cmpWidth - cmp.getStyle().getMargin(Component.LEFT)- cmp.getStyle().getMargin(Component.RIGHT));
            cmp.setHeight(cmpHeight- cmp.getStyle().getMargin(Component.TOP)- cmp.getStyle().getMargin(Component.BOTTOM));
            cmp.setX(x + (i%columns)*cmpWidth + cmp.getStyle().getMargin(Component.LEFT));
            cmp.setY(y + row*cmpHeight + cmp.getStyle().getMargin(Component.TOP));
            if((i + 1)%columns == 0){
                row++;
            }
        }
    }
View Full Code Here

        int height = 0;
       
        int numOfcomponents = parent.getComponentCount();
        int row = 0;       
        for(int i=0; i< numOfcomponents; i++){
            Component cmp = parent.getComponentAt(i);
            width = Math.max(width, cmp.getPreferredSize().getWidth() + cmp.getStyle().getMargin(Component.LEFT)+ cmp.getStyle().getMargin(Component.RIGHT));
            height = Math.max(height, cmp.getPreferredSize().getHeight()+ cmp.getStyle().getMargin(Component.TOP)+ cmp.getStyle().getMargin(Component.BOTTOM));
        }

        if(columns > 1){
            width = width*columns;
        }
View Full Code Here

    /**
     * @inheritDoc
     */
    public void addLayoutComponent(Object name, Component comp, Container c) {
        Component previous = null;

        /* Assign the component to one of the known regions of the layout.
         */
        if (CENTER.equals(name)) {
            previous = center;
View Full Code Here

        int left = target.getStyle().getPadding(Component.LEFT);
        int right = target.getLayoutWidth() - target.getSideGap() - target.getStyle().getPadding(Component.RIGHT);
        int targetWidth = target.getWidth();
        int targetHeight = target.getHeight();

        Component c = null;

        if (north != null) {
            c = north;
            c.setWidth(right - left - c.getStyle().getMargin(Component.LEFT) - c.getStyle().getMargin(Component.RIGHT));
            c.setHeight(Math.min(targetHeight, c.getPreferredSize().getHeight())); //verify I want to use tge prefered size
            c.setX(left + c.getStyle().getMargin(Component.LEFT));
            c.setY(top + c.getStyle().getMargin(Component.TOP));
            top += (c.getHeight() + c.getStyle().getMargin(Component.TOP) + c.getStyle().getMargin(Component.BOTTOM));

        }
        if (south != null) {
            c = south;
            c.setWidth(right - left - c.getStyle().getMargin(Component.LEFT) - c.getStyle().getMargin(Component.RIGHT));
            c.setHeight(Math.min(targetHeight, c.getPreferredSize().getHeight())); //verify I want to use tge prefered size
            c.setX(left + c.getStyle().getMargin(Component.LEFT));
            c.setY(bottom - c.getHeight() - c.getStyle().getMargin(Component.TOP));

            bottom -= (c.getHeight() + c.getStyle().getMargin(Component.TOP) + c.getStyle().getMargin(Component.BOTTOM));

        }
        if (east != null) {
            c = east;
            c.setWidth(Math.min(targetWidth, c.getPreferredSize().getWidth()));
            c.setHeight(bottom - top - c.getStyle().getMargin(Component.TOP) - c.getStyle().getMargin(Component.BOTTOM)); //verify I want to use tge prefered size
            c.setX(right - c.getWidth() - c.getStyle().getMargin(Component.LEFT));
            c.setY(top + c.getStyle().getMargin(Component.TOP));

            right -= (c.getWidth() + c.getStyle().getMargin(Component.LEFT) + c.getStyle().getMargin(Component.RIGHT));

        }
        if (west != null) {
            c = west;
            c.setWidth(Math.min(targetWidth, c.getPreferredSize().getWidth()));
            c.setHeight(bottom - top - c.getStyle().getMargin(Component.TOP) - c.getStyle().getMargin(Component.BOTTOM)); //verify I want to use tge prefered size
            c.setX(left + c.getStyle().getMargin(Component.LEFT));
            c.setY(top + c.getStyle().getMargin(Component.TOP));

            left += (c.getWidth() + c.getStyle().getMargin(Component.LEFT) + c.getStyle().getMargin(Component.RIGHT));

        }

        if (center != null) {
            c = center;
            c.setWidth(right - left - c.getStyle().getMargin(Component.LEFT) - c.getStyle().getMargin(Component.RIGHT));
            c.setHeight(bottom - top - c.getStyle().getMargin(Component.TOP) - c.getStyle().getMargin(Component.BOTTOM)); //verify I want to use the remaining size
            c.setX(left + c.getStyle().getMargin(Component.LEFT));
            c.setY(top + c.getStyle().getMargin(Component.TOP));
//            if(c instanceof Container) {
//                ((Container)c).layoutContainer();
//            }
        }
    }
View Full Code Here

        int x = parent.getStyle().getPadding(Component.LEFT);
        int y = parent.getStyle().getPadding(Component.TOP);
        int numOfcomponents = parent.getComponentCount();
       
        for(int i=0; i< numOfcomponents; i++){
            Component cmp = parent.getComponentAt(i);
           
            if(axis == Y_AXIS){
                int cmpBottom = height;
                int cmpH = cmp.getPreferredSize().getHeight();
               
                y += cmp.getStyle().getMargin(Component.TOP);
               
                if(y >= cmpBottom){
                    cmpH = 0;
                }else if(y + cmpH > cmpBottom){
                    cmpH = cmpBottom - y - cmp.getStyle().getMargin(Component.BOTTOM);
                }
               
                cmp.setWidth(width - cmp.getStyle().getMargin(Component.LEFT) - cmp.getStyle().getMargin(Component.RIGHT));
                cmp.setHeight(cmpH);
                cmp.setX(x + cmp.getStyle().getMargin(Component.LEFT));
                cmp.setY(y);
                y += cmp.getHeight() + cmp.getStyle().getMargin(Component.BOTTOM);
            }else{
                int cmpRight = width;
                int cmpW = cmp.getPreferredSize().getWidth();
               
                x += cmp.getStyle().getMargin(Component.RIGHT);

                if(x >= cmpRight){
                    cmpW = 0;
                }else if(x + cmpW > cmpRight){
                    cmpW = cmpRight - x - cmp.getStyle().getMargin(Component.RIGHT);
                }
               
                cmp.setWidth(cmpW);
                cmp.setHeight(height- cmp.getStyle().getMargin(Component.TOP) - cmp.getStyle().getMargin(Component.BOTTOM));
                cmp.setX(x);
                cmp.setY(y + cmp.getStyle().getMargin(Component.TOP));
                x += cmp.getWidth() + cmp.getStyle().getMargin(Component.RIGHT);
            }
        }
    }
View Full Code Here

TOP

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

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.