< prev index next >

src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java

Print this page

        

*** 23,40 **** * questions. */ /* * <p>These classes are designed to be used while the ! * corresponding <code>LookAndFeel</code> class has been installed * (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>). ! * Using them while a different <code>LookAndFeel</code> is installed * may produce unexpected results, including exceptions. ! * Additionally, changing the <code>LookAndFeel</code> ! * maintained by the <code>UIManager</code> without updating the ! * corresponding <code>ComponentUI</code> of any ! * <code>JComponent</code>s may also produce unexpected results, * such as the wrong colors showing up, and is generally not * encouraged. * */ --- 23,40 ---- * questions. */ /* * <p>These classes are designed to be used while the ! * corresponding {@code LookAndFeel} class has been installed * (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>). ! * Using them while a different {@code LookAndFeel} is installed * may produce unexpected results, including exceptions. ! * Additionally, changing the {@code LookAndFeel} ! * maintained by the {@code UIManager} without updating the ! * corresponding {@code ComponentUI} of any ! * {@code JComponent}s may also produce unexpected results, * such as the wrong colors showing up, and is generally not * encouraged. * */
*** 121,136 **** static boolean isVista() { XPStyle xp = XPStyle.getXP(); return (xp != null && xp.isSkinDefined(null, Part.CP_DROPDOWNBUTTONRIGHT)); } ! /** Get a named <code>String</code> value from the current style * ! * @param part a <code>Part</code> ! * @param state a <code>String</code> ! * @param attributeKey a <code>String</code> ! * @return a <code>String</code> or null if key is not found * in the current style * * This is currently only used by WindowsInternalFrameTitlePane for painting * title foregound and can be removed when no longer needed */ --- 121,136 ---- static boolean isVista() { XPStyle xp = XPStyle.getXP(); return (xp != null && xp.isSkinDefined(null, Part.CP_DROPDOWNBUTTONRIGHT)); } ! /** Get a named {@code String} value from the current style * ! * @param part a {@code Part} ! * @param state a {@code String} ! * @param attributeKey a {@code String} ! * @return a {@code String} or null if key is not found * in the current style * * This is currently only used by WindowsInternalFrameTitlePane for painting * title foregound and can be removed when no longer needed */
*** 156,181 **** } ! /** Get a named <code>int</code> value from the current style * ! * @param part a <code>Part</code> ! * @return an <code>int</code> or null if key is not found * in the current style */ int getInt(Component c, Part part, State state, Prop prop, int fallback) { return ThemeReader.getInt(part.getControlName(c), part.getValue(), State.getValue(part, state), prop.getValue()); } ! /** Get a named <code>Dimension</code> value from the current style * ! * @param key a <code>String</code> ! * @return a <code>Dimension</code> or null if key is not found * in the current style * * This is currently only used by WindowsProgressBarUI and the value * should probably be cached there instead of here. */ --- 156,181 ---- } ! /** Get a named {@code int} value from the current style * ! * @param part a {@code Part} ! * @return an {@code int} or null if key is not found * in the current style */ int getInt(Component c, Part part, State state, Prop prop, int fallback) { return ThemeReader.getInt(part.getControlName(c), part.getValue(), State.getValue(part, state), prop.getValue()); } ! /** Get a named {@code Dimension} value from the current style * ! * @param key a {@code String} ! * @return a {@code Dimension} or null if key is not found * in the current style * * This is currently only used by WindowsProgressBarUI and the value * should probably be cached there instead of here. */
*** 184,198 **** State.getValue(part, state), prop.getValue()); return (d != null) ? d : new Dimension(); } ! /** Get a named <code>Point</code> (e.g. a location or an offset) value * from the current style * ! * @param key a <code>String</code> ! * @return a <code>Point</code> or null if key is not found * in the current style * * This is currently only used by WindowsInternalFrameTitlePane for painting * title foregound and can be removed when no longer needed */ --- 184,198 ---- State.getValue(part, state), prop.getValue()); return (d != null) ? d : new Dimension(); } ! /** Get a named {@code Point} (e.g. a location or an offset) value * from the current style * ! * @param key a {@code String} ! * @return a {@code Point} or null if key is not found * in the current style * * This is currently only used by WindowsInternalFrameTitlePane for painting * title foregound and can be removed when no longer needed */
*** 201,214 **** State.getValue(part, state), prop.getValue()); return (d != null) ? new Point(d.width, d.height) : new Point(); } ! /** Get a named <code>Insets</code> value from the current style * ! * @param key a <code>String</code> ! * @return an <code>Insets</code> object or null if key is not found * in the current style * * This is currently only used to create borders and by * WindowsInternalFrameTitlePane for painting title foregound. * The return value is already cached in those places. --- 201,214 ---- State.getValue(part, state), prop.getValue()); return (d != null) ? new Point(d.width, d.height) : new Point(); } ! /** Get a named {@code Insets} value from the current style * ! * @param key a {@code String} ! * @return an {@code Insets} object or null if key is not found * in the current style * * This is currently only used to create borders and by * WindowsInternalFrameTitlePane for painting title foregound. * The return value is already cached in those places.
*** 219,232 **** prop.getValue()); return (insets != null) ? insets : new Insets(0, 0, 0, 0); } ! /** Get a named <code>Color</code> value from the current style * ! * @param part a <code>Part</code> ! * @return a <code>Color</code> or null if key is not found * in the current style */ synchronized Color getColor(Skin skin, Prop prop, Color fallback) { String key = skin.toString() + "." + prop.name(); Part part = skin.part; --- 219,232 ---- prop.getValue()); return (insets != null) ? insets : new Insets(0, 0, 0, 0); } ! /** Get a named {@code Color} value from the current style * ! * @param part a {@code Part} ! * @return a {@code Color} or null if key is not found * in the current style */ synchronized Color getColor(Skin skin, Prop prop, Color fallback) { String key = skin.toString() + "." + prop.name(); Part part = skin.part;
*** 247,260 **** return getColor(new Skin(c, part, state), prop, fallback); } ! /** Get a named <code>Border</code> value from the current style * ! * @param part a <code>Part</code> ! * @return a <code>Border</code> or null if key is not found * in the current style or if the style for the particular * part is not defined as "borderfill". */ synchronized Border getBorder(Component c, Part part) { if (part == Part.MENU) { --- 247,260 ---- return getColor(new Skin(c, part, state), prop, fallback); } ! /** Get a named {@code Border} value from the current style * ! * @param part a {@code Part} ! * @return a {@code Border} or null if key is not found * in the current style or if the style for the particular * part is not defined as "borderfill". */ synchronized Border getBorder(Component c, Part part) { if (part == Part.MENU) {
*** 444,458 **** || ThemeReader.isThemePartDefined( part.getControlName(c), part.getValue(), 0); } ! /** Get a <code>Skin</code> object from the current style * for a named part (component type) * ! * @param part a <code>Part</code> ! * @return a <code>Skin</code> object */ synchronized Skin getSkin(Component c, Part part) { assert isSkinDefined(c, part) : "part " + part + " is not defined"; return new Skin(c, part, null); } --- 444,458 ---- || ThemeReader.isThemePartDefined( part.getControlName(c), part.getValue(), 0); } ! /** Get a {@code Skin} object from the current style * for a named part (component type) * ! * @param part a {@code Part} ! * @return a {@code Skin} object */ synchronized Skin getSkin(Component c, Part part) { assert isSkinDefined(c, part) : "part " + part + " is not defined"; return new Skin(c, part, null); }
*** 562,572 **** } /** Paint a skin in an area defined by a rectangle. * * @param g the graphics context to use for painting ! * @param r a <code>Rectangle</code> defining the area to fill, * may cause the image to be stretched or tiled * @param state which state to paint */ void paintSkin(Graphics g, Rectangle r, State state) { paintSkin(g, r.x, r.y, r.width, r.height, state); --- 562,572 ---- } /** Paint a skin in an area defined by a rectangle. * * @param g the graphics context to use for painting ! * @param r a {@code Rectangle} defining the area to fill, * may cause the image to be stretched or tiled * @param state which state to paint */ void paintSkin(Graphics g, Rectangle r, State state) { paintSkin(g, r.x, r.y, r.width, r.height, state);
< prev index next >