Search in sources :

Example 31 with Image

use of org.apache.pivot.wtk.media.Image in project pivot by apache.

the class TextPaneSkinImageNodeView method childLayout.

@Override
protected void childLayout(int breakWidth) {
    ImageNode imageNode = (ImageNode) getNode();
    Image image = imageNode.getImage();
    if (image == null) {
        setSize(0, 0);
    } else {
        setSize(image.getWidth(), image.getHeight());
    }
}
Also used : ImageNode(org.apache.pivot.wtk.text.ImageNode) Image(org.apache.pivot.wtk.media.Image)

Example 32 with Image

use of org.apache.pivot.wtk.media.Image in project pivot by apache.

the class ImageNode method setImage.

public void setImage(Image image) {
    Image previousImage = this.image;
    if (previousImage != image) {
        this.image = image;
        imageNodeListeners.imageChanged(this, previousImage);
    }
}
Also used : Image(org.apache.pivot.wtk.media.Image)

Example 33 with Image

use of org.apache.pivot.wtk.media.Image in project pivot by apache.

the class TerraTheme method loadMessageIcons.

private void loadMessageIcons(Map<String, String> messageIconNames, Map<MessageType, Image> messageIconsMap) {
    for (String messageIconType : messageIconNames) {
        String messageIconName = messageIconNames.get(messageIconType);
        Image messageIcon;
        try {
            messageIcon = Image.load(getClass().getResource(messageIconName));
        } catch (TaskExecutionException exception) {
            throw new RuntimeException(exception);
        }
        messageIconsMap.put(MessageType.fromString(messageIconType), messageIcon);
    }
}
Also used : TaskExecutionException(org.apache.pivot.util.concurrent.TaskExecutionException) Image(org.apache.pivot.wtk.media.Image)

Example 34 with Image

use of org.apache.pivot.wtk.media.Image in project pivot by apache.

the class TerraExpanderSkin method install.

@Override
public void install(Component component) {
    super.install(component);
    Expander expander = (Expander) component;
    expander.add(titleBarTablePane);
    Image buttonData = expander.isExpanded() ? collapseImage : expandImage;
    shadeButton = new ShadeButton(buttonData);
    buttonBoxPane.add(shadeButton);
    shadeButton.getButtonPressListeners().add(this);
    Theme theme = currentTheme();
    theme.setDefaultStyles(this);
    titleChanged(expander, null);
    collapsibleChanged(expander);
    enabledChanged(expander);
}
Also used : Expander(org.apache.pivot.wtk.Expander) Theme(org.apache.pivot.wtk.Theme) Image(org.apache.pivot.wtk.media.Image)

Example 35 with Image

use of org.apache.pivot.wtk.media.Image in project pivot by apache.

the class ListButtons method initialize.

@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
    listButton = (ListButton) namespace.get("listButton");
    imageView = (ImageView) namespace.get("imageView");
    listButton.getListButtonSelectionListeners().add(new ListButtonSelectionListener() {

        @Override
        public void selectedItemChanged(ListButton listButtonArgument, Object previousSelectedItem) {
            Object selectedItem = listButtonArgument.getSelectedItem();
            if (selectedItem != null) {
                // Get the image URL for the selected item
                Image image = Image.loadFromCache(ImageUtils.findByName("/org/apache/pivot/tutorials/" + selectedItem, "image"));
                // Update the image
                imageView.setImage(image);
            }
        }
    });
    listButton.setSelectedIndex(0);
}
Also used : ListButton(org.apache.pivot.wtk.ListButton) ListButtonSelectionListener(org.apache.pivot.wtk.ListButtonSelectionListener) Image(org.apache.pivot.wtk.media.Image)

Aggregations

Image (org.apache.pivot.wtk.media.Image)35 Color (java.awt.Color)8 ImageView (org.apache.pivot.wtk.ImageView)8 Font (java.awt.Font)6 Component (org.apache.pivot.wtk.Component)5 ImageNode (org.apache.pivot.wtk.text.ImageNode)5 Dimensions (org.apache.pivot.wtk.Dimensions)3 Point (org.apache.pivot.wtk.Point)3 BasicStroke (java.awt.BasicStroke)2 Graphics2D (java.awt.Graphics2D)2 IOException (java.io.IOException)2 DragSource (org.apache.pivot.wtk.DragSource)2 DropAction (org.apache.pivot.wtk.DropAction)2 DropTarget (org.apache.pivot.wtk.DropTarget)2 Insets (org.apache.pivot.wtk.Insets)2 LocalManifest (org.apache.pivot.wtk.LocalManifest)2 Manifest (org.apache.pivot.wtk.Manifest)2 AlphaComposite (java.awt.AlphaComposite)1 Composite (java.awt.Composite)1 GradientPaint (java.awt.GradientPaint)1