Package pivot.wtk.media

Examples of pivot.wtk.media.Image


        // via layout; ensure that it is valid here
        validate();
    }

    public void render(Object data, Button button, boolean highlighted) {
        Image icon = null;
        String text = null;

        if (data instanceof ButtonData) {
            ButtonData buttonData = (ButtonData)data;
            icon = buttonData.getIcon();
View Full Code Here


        return (image == null) ? 0 : image.getWidth();
    }

    public int getPreferredHeight(int width) {
        ImageView imageView = (ImageView)getComponent();
        Image image = imageView.getImage();

        return (image == null) ? 0 : image.getHeight();
    }
View Full Code Here

        return (image == null) ? 0 : image.getHeight();
    }

    public Dimensions getPreferredSize() {
        ImageView imageView = (ImageView)getComponent();
        Image image = imageView.getImage();

        return (image == null) ? new Dimensions(0, 0) : new Dimensions(image.getWidth(),
            image.getHeight());
    }
View Full Code Here

            image.getHeight());
    }

    public void layout() {
        ImageView imageView = (ImageView)getComponent();
        Image image = imageView.getImage();

        if (image != null) {
            int width = getWidth();
            int height = getHeight();

            Dimensions imageSize = image.getSize();

            if (horizontalAlignment == HorizontalAlignment.JUSTIFY) {
                imageX = 0;
                scaleX = (float)width / (float)imageSize.width;
            } else {
View Full Code Here

        }
    }

    public void paint(Graphics2D graphics) {
        ImageView imageView = (ImageView)getComponent();
        Image image = imageView.getImage();

        int width = getWidth();
        int height = getHeight();

        if (backgroundColor != null) {
            graphics.setPaint(backgroundColor);
            graphics.fillRect(0, 0, width, height);
        }

        if (image != null) {
            Graphics2D imageGraphics = (Graphics2D)graphics.create();
            imageGraphics.translate(imageX, imageY);
            imageGraphics.scale(scaleX, scaleY);

            // Apply an alpha composite if the opacity value is less than
            // the current alpha
            float alpha = 1.0f;

            Composite composite = imageGraphics.getComposite();
            if (composite instanceof AlphaComposite) {
                AlphaComposite alphaComposite = (AlphaComposite)composite;
                alpha = alphaComposite.getAlpha();
            }

            if (opacity < alpha) {
                imageGraphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));
            }

            image.paint(imageGraphics);
            imageGraphics.dispose();
        }
    }
View Full Code Here

    public void imageChanged(ImageView imageView, Image previousImage) {
        if (previousImage != null) {
            previousImage.getImageListeners().remove(imageListener);
        }

        Image image = imageView.getImage();
        if (image != null) {
            image.getImageListeners().add(imageListener);
        }

        invalidateComponent();
    }
View Full Code Here

        // via layout; ensure that it is valid here
        validate();
    }

    public void render(Object data, TableViewHeader tableViewHeader, boolean highlighted) {
        Image icon = null;
        String text = null;

        if (data instanceof TableViewHeaderData) {
            TableViewHeaderData tableViewHeaderData = (TableViewHeaderData)data;
            icon = tableViewHeaderData.getIcon();
View Full Code Here

    public void setIcon(Image icon) {
        this.icon = icon;
    }

    public void setIcon(URL iconURL) {
        Image icon = (Image)ApplicationContext.getResourceCache().get(iconURL);

        if (icon == null) {
            icon = Image.load(iconURL);
            ApplicationContext.getResourceCache().put(iconURL, icon);
        }
View Full Code Here

    public void setIcon(Image icon) {
        this.icon = icon;
    }

    public void setIcon(URL iconURL) {
        Image icon = (Image)ApplicationContext.getResourceCache().get(iconURL);

        if (icon == null) {
            icon = Image.load(iconURL);
            ApplicationContext.getResourceCache().put(iconURL, icon);
        }
View Full Code Here

    }

    public void render(Object node, TreeView treeView, boolean expanded,
        boolean selected, TreeView.NodeCheckState checkState,
        boolean highlighted, boolean disabled) {
        Image icon = null;
        String text = null;

        if (node instanceof TreeNode) {
            TreeNode treeNode = (TreeNode)node;
View Full Code Here

TOP

Related Classes of pivot.wtk.media.Image

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.