Package org.noos.xing.mydoggy.plaf.ui.icons

Examples of org.noos.xing.mydoggy.plaf.ui.icons.CompositeIcon


            this.popupMenu = popupMenu;
        }

        public String getToolTipTextAt(MouseEvent e, int index, String defaultTip) {
            if (index != -1) {
                CompositeIcon compositeIcon = (CompositeIcon) ((CompositeIcon) getContentIcon()).getIcon2();

                if (isDetachable()) {
                    Rectangle detachIconRect = compositeIcon.getIcon1Rec();
                    if (e.getX() > detachIconRect.x && e.getX() < detachIconRect.x + detachIconRect.width) {
                        return "Detach";
                    }
                }

                if (isClosable()) {
                    Rectangle closeIconRect = compositeIcon.getIcon2Rec();
                    if (e.getX() > closeIconRect.x && e.getX() < closeIconRect.x + closeIconRect.width) {
                        return "Close";
                    }
                }
                return (defaultTip.equals("")) ? null : defaultTip;
View Full Code Here


                                super.paintIcon(c, g, x, y);
                            } else
                                throw new IllegalStateException("Invalid Content Index");
                        }
                    };
                leftIcon = new CompositeIcon(titleIcon, icon, SwingConstants.LEFT);

                // Right Part
                Icon rightIcon = new CompositeIcon(maxImgD, closeImgD, SwingConstants.LEFT) {
                    boolean isSelected;
                    int count;

                    public void paintIcon(Component c, Graphics g, int x, int y) {
                        Component tabComponent = (Component) accessible.getAccessibleChild(0);
                        isSelected = false;
                        for (int i = 0, size = tabbedPane.getTabCount(); i < size; i++) {
                            if (tabbedPane.getComponentAt(i) == tabComponent) {
                                if (tabbedPane.getSelectedIndex() == i)
                                    isSelected = true;
                                break;
                            }
                        }
                        count = 0;
                        super.paintIcon(c, g, x, y);
                    }

                    protected void paintIconInternal(Component c, Graphics g, Icon icon, int x, int y, int width, int height, int horizontalOrientation, int verticalOrientation) {
                        if (count == 0) {
                            super.paintIconInternal(c, g,
                                                    isSelected ? maxImgI : maxImgD,
                                                    x, y, width, height, horizontalOrientation, verticalOrientation);

                        } else if (count == 1) {
                            super.paintIconInternal(c, g,
                                                    isSelected ? closeImgI : closeImgD,
                                                    x, y, width, height, horizontalOrientation, verticalOrientation);
                        }
                        count = (count + 1) % 2;
                    }

                    protected void paint(Component c, Graphics g, Icon icon, int x, int y) {
                        super.paint(c, g, icon, x, y);
                        if (count == 0) {
                            icon1Rec = new Rectangle(x, y, getIconWidth(icon1), getIconHeight(icon1));
                        } else
                            icon2Rec = new Rectangle(x, y, getIconWidth(icon2), getIconHeight(icon2));
                    }
                };

                contentIcon = new CompositeIcon(leftIcon, rightIcon, SwingConstants.LEFT);
            }
            return contentIcon;
        }
View Full Code Here

    class MouseOverTabListener extends MouseInputAdapter {
        private int mouseOverTab = -1;

        public void mouseClicked(MouseEvent e) {
            if (mouseOverTab >= 0 && mouseOverTab < getTabCount()) {
                CompositeIcon compositeIcon = (CompositeIcon) ((CompositeIcon) getContentPage(mouseOverTab).getContentIcon()).getIcon2();

                Rectangle detachIconRect = compositeIcon.getIcon1Rec();
                if (e.getX() > detachIconRect.x && e.getX() < detachIconRect.x + detachIconRect.width) {
                    fireDetachTabEvent(e, mouseOverTab);
                    return;
                }

                Rectangle closeIconRect = compositeIcon.getIcon2Rec();
                if (e.getX() > closeIconRect.x && e.getX() < closeIconRect.x + closeIconRect.width) {
                    fireCloseTabEvent(e, mouseOverTab);
                    return;
                }
View Full Code Here

            contentIcon = null;
        }

        public String getToolTipTextAt(MouseEvent e, int index, String defaultTip) {
            if (index != -1) {
                CompositeIcon compositeIcon = (CompositeIcon) ((CompositeIcon) getContentIcon()).getRightIcon();

                Point point = SwingUtilities.convertPoint(tabbedPane, e.getPoint(), getDestination());

                if (isDetachable()) {
                    Rectangle detachIconRect = compositeIcon.getLastPaintedLeftRec();
                    if (point.getX() > detachIconRect.x && point.getX() < detachIconRect.x + detachIconRect.width) {
                        return "Detach";
                    }
                }

                if (isCloseable()) {
                    Rectangle closeIconRect = compositeIcon.getLastPaintedRightRec();
                    if (point.getX() > closeIconRect.x && point.getX() < closeIconRect.x + closeIconRect.width) {
                        return "Close";
                    }
                }
                return (defaultTip.equals("")) ? null : defaultTip;
View Full Code Here

                Icon titleIcon = null;
                if (title != null)
                    titleIcon = new DynamicTextIcon();

                // Right Part
                contentIcon = new CompositeIcon(new CompositeIcon(icon, titleIcon, SwingConstants.LEFT),
                                                new DoubleIcon(), SwingConstants.LEFT,
                                                SwingConstants.LEFT, SwingConstants.TOP);
            }
            return contentIcon;
        }
View Full Code Here

                ContentPage contentPage = getContentPage(mouseOverTab);


                Point relativeMousePoint = SwingUtilities.convertPoint(JTabbedContentManager.this, e.getPoint(),
                                                                       contentPage.getDestination());
                CompositeIcon uiCompositeIcon = contentPage.getUICompositeIcon();

                Rectangle detachIconRect = uiCompositeIcon.getLastPaintedLeftRec();
                if (contentPage.isDetachable() && ((relativeMousePoint.getX() > detachIconRect.x && relativeMousePoint.getX() < detachIconRect.x + detachIconRect.width) ||
                                                   (e.getX() > detachIconRect.x && e.getX() < detachIconRect.x + detachIconRect.width))) {
                    fireDetachTabEvent(e, mouseOverTab);
                    return;
                }

                Rectangle closeIconRect = uiCompositeIcon.getLastPaintedRightRec();
                if (contentPage.isCloseable() && ((relativeMousePoint.getX() > closeIconRect.x && relativeMousePoint.getX() < closeIconRect.x + closeIconRect.width) ||
                                                  (e.getX() > closeIconRect.x && e.getX() < closeIconRect.x + closeIconRect.width))) {
                    fireCloseTabEvent(e, mouseOverTab);
                    return;
                }
View Full Code Here

        this.accessible = accessible;
    }

    public String getToolTipTextAt(MouseEvent e, int index, String defaultTip) {
        if (index != -1) {
            CompositeIcon compositeIcon = (CompositeIcon) ((CompositeIcon) getContentIcon()).getRightIcon();

            Point point = SwingUtilities.convertPoint(tabbedPane, e.getPoint(), getDestination());

            if (isDetachable()) {
                Rectangle detachIconRect = compositeIcon.getLastPaintedLeftRec();
                if (point.getX() > detachIconRect.x && point.getX() < detachIconRect.x + detachIconRect.width) {
                    return ResourceBoundles.getResourceBundle().getString("@@tab.content.detach");
                }
            }

            if (isCloseable()) {
                Rectangle closeIconRect = compositeIcon.getLastPaintedRightRec();
                if (point.getX() > closeIconRect.x && point.getX() < closeIconRect.x + closeIconRect.width) {
                    return ResourceBoundles.getResourceBundle().getString("@@tab.content.close");
                }
            }
            return (defaultTip.equals("")) ? null : defaultTip;
View Full Code Here

            Icon titleIcon = null;
            if (title != null)
                titleIcon = new DynamicTextIcon();

            // Right Part
            contentIcon = new CompositeIcon(new CompositeIcon(icon, titleIcon, SwingConstants.LEFT),
                                            new DoubleIcon(), SwingConstants.LEFT,
                                            SwingConstants.LEFT, SwingConstants.TOP);
        }
        return contentIcon;
    }
View Full Code Here

        return contentIcon;
    }

    public boolean isDetachFired(Point point) {
        Point relativeMousePoint = SwingUtilities.convertPoint(tabbedPane, point, getDestination());
        CompositeIcon uiCompositeIcon = getUICompositeIcon();

        Rectangle detachIconRect = uiCompositeIcon.getLastPaintedLeftRec();
        return (isDetachable() && ((relativeMousePoint.getX() > detachIconRect.x && relativeMousePoint.getX() < detachIconRect.x + detachIconRect.width) ||
                                   (point.getX() > detachIconRect.x && point.getX() < detachIconRect.x + detachIconRect.width)));
    }
View Full Code Here

        this.content = content;
    }
   
    public boolean isCloseFired(Point point) {
        Point relativeMousePoint = SwingUtilities.convertPoint(tabbedPane, point, getDestination());
        CompositeIcon uiCompositeIcon = getUICompositeIcon();

        Rectangle closeIconRect = uiCompositeIcon.getLastPaintedRightRec();
        return (isCloseable() && ((relativeMousePoint.getX() > closeIconRect.x && relativeMousePoint.getX() < closeIconRect.x + closeIconRect.width) ||
                                  (point.getX() > closeIconRect.x && point.getX() < closeIconRect.x + closeIconRect.width)));
    }
View Full Code Here

TOP

Related Classes of org.noos.xing.mydoggy.plaf.ui.icons.CompositeIcon

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.