Package com.sun.java.swing.plaf.windows.XPStyle

Examples of com.sun.java.swing.plaf.windows.XPStyle.Skin


    public void paintTrack(Graphics g)  {
        XPStyle xp = XPStyle.getXP();
        if (xp != null) {
            boolean vertical = (slider.getOrientation() == JSlider.VERTICAL);
            Part part = vertical ? Part.TKP_TRACKVERT : Part.TKP_TRACK;
            Skin skin = xp.getSkin(slider, part);

            if (vertical) {
                int x = (trackRect.width - skin.getWidth()) / 2;
                skin.paintSkin(g, trackRect.x + x, trackRect.y,
                               skin.getWidth(), trackRect.height, null);
            } else {
                int y = (trackRect.height - skin.getHeight()) / 2;
                skin.paintSkin(g, trackRect.x, trackRect.y + y,
                               trackRect.width, skin.getHeight(), null);
            }
        } else {
            super.paintTrack(g);
        }
    }
View Full Code Here


    protected Dimension getThumbSize() {
        XPStyle xp = XPStyle.getXP();
        if (xp != null) {
            Dimension size = new Dimension();
            Skin s = xp.getSkin(slider, getXPThumbPart());
            size.width = s.getWidth();
            size.height = s.getHeight();
            return size;
        } else {
            return super.getThumbSize();
        }
    }
View Full Code Here

            // Paint thumb
            Part thumbPart = v ? Part.SBP_THUMBBTNVERT : Part.SBP_THUMBBTNHORZ;
            xp.getSkin(sb, thumbPart).paintSkin(g, thumbBounds, state);
            // Paint gripper
            Part gripperPart = v ? Part.SBP_GRIPPERVERT : Part.SBP_GRIPPERHORZ;
            Skin skin = xp.getSkin(sb, gripperPart);
            Insets gripperInsets = xp.getMargin(c, thumbPart, null, Prop.CONTENTMARGINS);
            if (gripperInsets == null ||
                (v && (thumbBounds.height - gripperInsets.top -
                       gripperInsets.bottom >= skin.getHeight())) ||
                (!v && (thumbBounds.width - gripperInsets.left -
                        gripperInsets.right >= skin.getWidth()))) {
                skin.paintSkin(g,
                               thumbBounds.x + (thumbBounds.width  - skin.getWidth()) / 2,
                               thumbBounds.y + (thumbBounds.height - skin.getHeight()) / 2,
                               skin.getWidth(), skin.getHeight(), state);
            }
        } else {
            super.paintThumb(g, c, thumbBounds);
        }
    }
View Full Code Here

        public void paint(Graphics g) {
            XPStyle xp = XPStyle.getXP();
            if (xp != null) {
                ButtonModel model = getModel();
                Skin skin = xp.getSkin(this, Part.SBP_ARROWBTN);
                State state = null;

                boolean jointRollover = XPStyle.isVista() && (isThumbRollover() ||
                    (this == incrButton && decrButton.getModel().isRollover()) ||
                    (this == decrButton && incrButton.getModel().isRollover()));

                // normal, rollover, pressed, disabled
                if (model.isArmed() && model.isPressed()) {
                    switch (direction) {
                        case NORTH: state = State.UPPRESSED;    break;
                        case SOUTH: state = State.DOWNPRESSED;  break;
                        case WEST:  state = State.LEFTPRESSED;  break;
                        case EAST:  state = State.RIGHTPRESSED; break;
                    }
                } else if (!model.isEnabled()) {
                    switch (direction) {
                        case NORTH: state = State.UPDISABLED;    break;
                        case SOUTH: state = State.DOWNDISABLED;  break;
                        case WEST:  state = State.LEFTDISABLED;  break;
                        case EAST:  state = State.RIGHTDISABLED; break;
                    }
                } else if (model.isRollover() || model.isPressed()) {
                    switch (direction) {
                        case NORTH: state = State.UPHOT;    break;
                        case SOUTH: state = State.DOWNHOT;  break;
                        case WEST:  state = State.LEFTHOT;  break;
                        case EAST:  state = State.RIGHTHOT; break;
                    }
                } else if (jointRollover) {
                    switch (direction) {
                        case NORTH: state = State.UPHOVER;    break;
                        case SOUTH: state = State.DOWNHOVER;  break;
                        case WEST:  state = State.LEFTHOVER;  break;
                        case EAST:  state = State.RIGHTHOVER; break;
                    }
                } else {
                    switch (direction) {
                        case NORTH: state = State.UPNORMAL;    break;
                        case SOUTH: state = State.DOWNNORMAL;  break;
                        case WEST:  state = State.LEFTNORMAL;  break;
                        case EAST:  state = State.RIGHTNORMAL; break;
                    }
                }

                skin.paintSkin(g, 0, 0, getWidth(), getHeight(), state);
            } else {
                super.paint(g);
            }
        }
View Full Code Here

    }

    private void paintXPComboBoxBackground(Graphics g, JComponent c) {
        XPStyle xp = XPStyle.getXP();
        State state = getXPComboBoxState(c);
        Skin skin = null;
        if (! comboBox.isEditable()
              && xp.isSkinDefined(c, Part.CP_READONLY)) {
            skin = xp.getSkin(c, Part.CP_READONLY);
        }
        if (skin == null) {
            skin = xp.getSkin(c, Part.CP_COMBOBOX);
        }
        skin.paintSkin(g, 0, 0, c.getWidth(), c.getHeight(), state);
    }
View Full Code Here

            int width = getIconWidth();
            int height = getIconHeight();

            XPStyle xp = XPStyle.getXP();
            if (xp != null) {
                Skin skin = xp.getSkin(c, part);
                JButton b = (JButton)c;
                ButtonModel model = b.getModel();

                // Find out if frame is inactive
                JInternalFrame jif = (JInternalFrame)SwingUtilities.
                                        getAncestorOfClass(JInternalFrame.class, b);
                boolean jifSelected = (jif != null && jif.isSelected());

                State state;
                if (jifSelected) {
                    if (!model.isEnabled()) {
                        state = State.DISABLED;
                    } else if (model.isArmed() && model.isPressed()) {
                        state = State.PUSHED;
                    } else if (model.isRollover()) {
                        state = State.HOT;
                    } else {
                        state = State.NORMAL;
                    }
                } else {
                    if (!model.isEnabled()) {
                        state = State.INACTIVEDISABLED;
                    } else if (model.isArmed() && model.isPressed()) {
                        state = State.INACTIVEPUSHED;
                    } else if (model.isRollover()) {
                        state = State.INACTIVEHOT;
                    } else {
                        state = State.INACTIVENORMAL;
                    }
                }
                skin.paintSkin(g, 0, 0, width, height, state);
            } else {
                g.setColor(Color.black);
                int x = width / 12 + 2;
                int y = height / 5;
                int h = height - y * 2 - 1;
View Full Code Here

            ButtonModel model = b.getModel();
            XPStyle xp = XPStyle.getXP();

            if (xp != null) {
                Part part = Part.BP_RADIOBUTTON;
                Skin skin = xp.getSkin(b, part);
                State state;
                int index = 0;
                if (model.isSelected()) {
                    state = State.CHECKEDNORMAL;
                    if (!model.isEnabled()) {
                        state = State.CHECKEDDISABLED;
                    } else if (model.isPressed() && model.isArmed()) {
                        state = State.CHECKEDPRESSED;
                    } else if (model.isRollover()) {
                        state = State.CHECKEDHOT;
                    }
                } else {
                    state = State.UNCHECKEDNORMAL;
                    if (!model.isEnabled()) {
                        state = State.UNCHECKEDDISABLED;
                    } else if (model.isPressed() && model.isArmed()) {
                        state = State.UNCHECKEDPRESSED;
                    } else if (model.isRollover()) {
                        state = State.UNCHECKEDHOT;
                    }
                }
                skin.paintSkin(g, x, y, state);
            } else {
                // fill interior
                if((model.isPressed() && model.isArmed()) || !model.isEnabled()) {
                    g.setColor(UIManager.getColor("RadioButton.background"));
                } else {
View Full Code Here

                State state = State.NORMAL;
                if (c instanceof JMenuItem) {
                    state = ((JMenuItem) c).getModel().isEnabled()
                    ? State.NORMAL : State.DISABLED;
                }
                Skin skin = xp.getSkin(c, Part.MP_POPUPSUBMENU);
                if (WindowsGraphicsUtils.isLeftToRight(c)) {
                    skin.paintSkin(g, x, y, state);
                } else {
                    Graphics2D g2d = (Graphics2D)g.create();
                    g2d.translate(x + skin.getWidth(), y);
                    g2d.scale(-1, 1);
                    skin.paintSkin(g2d, 0, 0, state);
                    g2d.dispose();
                }
            } else {
                g.translate(x,y);
                if( WindowsGraphicsUtils.isLeftToRight(c) ) {
View Full Code Here

                g.translate(-x,-y);
            }
        }
        public int getIconWidth() {
            if (WindowsMenuItemUI.isVistaPainting()) {
                Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
                return skin.getWidth();
            } else {
                return 4;
            }
        }
View Full Code Here

                return 4;
            }
        }
        public int getIconHeight() {
            if (WindowsMenuItemUI.isVistaPainting()) {
                Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
                return skin.getHeight();
            } else {
                return 8;
            }
        }
View Full Code Here

TOP

Related Classes of com.sun.java.swing.plaf.windows.XPStyle.Skin

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.