0001: package com.jidesoft.plaf.office2003;
0002:
0003: import com.jidesoft.icons.IconsFactory;
0004: import com.jidesoft.plaf.LookAndFeelFactory;
0005: import com.jidesoft.plaf.XPUtils;
0006: import com.jidesoft.plaf.basic.BasicPainter;
0007: import com.jidesoft.plaf.basic.ThemePainter;
0008: import com.jidesoft.swing.ComponentStateSupport;
0009: import com.jidesoft.swing.JideSwingUtilities;
0010: import com.jidesoft.utils.ColorUtils;
0011: import com.jidesoft.utils.SystemInfo;
0012:
0013: import javax.swing.*;
0014: import javax.swing.plaf.ColorUIResource;
0015: import javax.swing.plaf.UIResource;
0016: import java.awt.*;
0017: import java.awt.geom.RoundRectangle2D;
0018: import java.beans.PropertyChangeEvent;
0019: import java.beans.PropertyChangeListener;
0020: import java.util.Collection;
0021: import java.util.Map;
0022: import java.util.TreeMap;
0023:
0024: /**
0025: * Painter for Office2003 L&F.
0026: * <p/>
0027: * Please note, this class is an internal class which is meant to be used by other JIDE classes only.
0028: * Future version might break your build if you use it.
0029: */
0030: public class Office2003Painter extends BasicPainter {
0031:
0032: private static Office2003Painter _instance;
0033:
0034: public static ThemePainter getInstance() {
0035: if (_instance == null) {
0036: _instance = new Office2003Painter();
0037: PropertyChangeListener listener = new PropertyChangeListener() {
0038: public void propertyChange(PropertyChangeEvent evt) {
0039: if (Office2003Painter.isNative()) {
0040: if (XPUtils.PROPERTY_COLORNAME.equals(evt
0041: .getPropertyName())) {
0042: if (evt.getNewValue() != null) {
0043: _instance.setColorName((String) evt
0044: .getNewValue());
0045: } else {
0046: _instance.setColorName("");
0047: }
0048: } else if (XPUtils.PROPERTY_THEMEACTIVE
0049: .equals(evt.getPropertyName())) {
0050: if (evt.getNewValue().equals(Boolean.FALSE))
0051: _instance.setColorName("");
0052: else {
0053: _instance.setColorName(XPUtils
0054: .getColorName());
0055: }
0056: }
0057: }
0058: }
0059: };
0060: Toolkit.getDefaultToolkit().addPropertyChangeListener(
0061: XPUtils.PROPERTY_COLORNAME, listener);
0062: Toolkit.getDefaultToolkit().addPropertyChangeListener(
0063: XPUtils.PROPERTY_THEMEACTIVE, listener);
0064:
0065: if (Office2003Painter.isNative()) {
0066: try {
0067: if (XPUtils.isXPStyleOn()) {
0068: _instance.setColorName(XPUtils.getColorName());
0069: } else {
0070: _instance.setColorName("");
0071: }
0072: } catch (UnsupportedOperationException e) {
0073: _instance.setColorName("");
0074: }
0075: }
0076: }
0077: return _instance;
0078: }
0079:
0080: private String _colorName = XPUtils.DEFAULT;
0081:
0082: private static boolean _native = SystemInfo.isWindowsXP();
0083:
0084: private static Office2003Theme _defaultTheme = new DefaultOffice2003Theme();
0085: private static Office2003Theme _normalTheme = new Office2003Theme(
0086: XPUtils.GRAY);
0087: private static Office2003Theme _blueTheme = new Office2003Theme(
0088: XPUtils.BLUE);
0089: private static Office2003Theme _homeSteadTheme = new Office2003Theme(
0090: XPUtils.HOMESTEAD);
0091: private static Office2003Theme _metallicTheme = new Office2003Theme(
0092: XPUtils.METALLIC);
0093:
0094: private static Map<String, Office2003Theme> _themeCache = new TreeMap();
0095:
0096: static {
0097: _themeCache.put(_defaultTheme.getThemeName(), _defaultTheme);
0098: _themeCache.put(_normalTheme.getThemeName(), _normalTheme);
0099: _themeCache.put(_blueTheme.getThemeName(), _blueTheme);
0100: _themeCache
0101: .put(_homeSteadTheme.getThemeName(), _homeSteadTheme);
0102: _themeCache.put(_metallicTheme.getThemeName(), _metallicTheme);
0103:
0104: final int SIZE = 20;
0105: final int MASK_SIZE = 11;
0106:
0107: int products = LookAndFeelFactory.getProductsUsed();
0108:
0109: Object uiDefaultsNormal[] = { "control",
0110: new ColorUIResource(219, 216, 209), "controlLt",
0111: new ColorUIResource(245, 244, 242), "controlDk",
0112: new ColorUIResource(213, 210, 202), "controlShadow",
0113: new ColorUIResource(128, 128, 128),
0114:
0115: "TabbedPane.selectDk",
0116: new ColorUIResource(230, 139, 44),
0117: "TabbedPane.selectLt",
0118: new ColorUIResource(255, 199, 60),
0119:
0120: "OptionPane.bannerLt", new ColorUIResource(0, 52, 206),
0121: "OptionPane.bannerDk",
0122: new ColorUIResource(45, 96, 249),
0123: "OptionPane.bannerForeground",
0124: new ColorUIResource(255, 255, 255),
0125:
0126: "Separator.foreground",
0127: new ColorUIResource(166, 166, 166),
0128: "Separator.foregroundLt",
0129: new ColorUIResource(255, 255, 255),
0130:
0131: "Gripper.foreground",
0132: new ColorUIResource(160, 160, 160),
0133: "Gripper.foregroundLt",
0134: new ColorUIResource(255, 255, 255),
0135:
0136: "Chevron.backgroundLt",
0137: new ColorUIResource(160, 160, 160),
0138: "Chevron.backgroundDk",
0139: new ColorUIResource(128, 128, 128),
0140:
0141: "Divider.backgroundLt",
0142: new ColorUIResource(110, 110, 110),
0143: "Divider.backgroundDk",
0144: new ColorUIResource(90, 90, 90),
0145:
0146: "backgroundLt", new ColorUIResource(245, 245, 244),
0147: "backgroundDk", new ColorUIResource(212, 208, 200),
0148:
0149: "selection.border", new ColorUIResource(0, 0, 128),
0150:
0151: "MenuItem.background",
0152: new ColorUIResource(249, 248, 247),
0153:
0154: "DockableFrameTitlePane.backgroundLt",
0155: new ColorUIResource(243, 242, 240),
0156: "DockableFrameTitlePane.backgroundDk",
0157: new ColorUIResource(212, 208, 200),
0158: "DockableFrameTitlePane.activeForeground",
0159: new ColorUIResource(0, 0, 0),
0160: "DockableFrameTitlePane.inactiveForeground",
0161: new ColorUIResource(0, 0, 0),
0162: "DockableFrame.backgroundLt",
0163: new ColorUIResource(234, 232, 228),
0164: "DockableFrame.backgroundDk",
0165: new ColorUIResource(234, 232, 228),
0166:
0167: "CommandBar.titleBarBackground",
0168: new ColorUIResource(128, 128, 128), };
0169: _normalTheme.putDefaults(uiDefaultsNormal);
0170:
0171: if ((products & LookAndFeelFactory.PRODUCT_COMPONENTS) != 0) {
0172: ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(
0173: Office2003WindowsUtils.class,
0174: "icons/collapsible_pane_gray.png"); // 20 x 20
0175: ImageIcon collapsiblePaneMask = IconsFactory.getImageIcon(
0176: Office2003WindowsUtils.class,
0177: "icons/collapsible_pane_mask.png"); // 11 x 11
0178: ImageIcon normalIcon = IconsFactory.getIcon(null,
0179: collapsiblePaneImage, 0, 0, SIZE, SIZE);
0180: ImageIcon emphasizedIcon = IconsFactory.getIcon(null,
0181: collapsiblePaneImage, SIZE, 0, SIZE, SIZE);
0182: ImageIcon upMark = IconsFactory.getIcon(null,
0183: collapsiblePaneMask, 0, 0, MASK_SIZE, MASK_SIZE);
0184: ImageIcon downMark = IconsFactory.getIcon(null,
0185: collapsiblePaneMask, 0, MASK_SIZE, MASK_SIZE,
0186: MASK_SIZE);
0187: uiDefaultsNormal = new Object[] {
0188: "CollapsiblePane.contentBackground",
0189: new ColorUIResource(255, 255, 255),
0190: "CollapsiblePanes.backgroundLt",
0191: new ColorUIResource(160, 160, 160),
0192: "CollapsiblePanes.backgroundDk",
0193: new ColorUIResource(128, 128, 128),
0194: "CollapsiblePaneTitlePane.backgroundLt",
0195: new ColorUIResource(255, 255, 255),
0196: "CollapsiblePaneTitlePane.backgroundDk",
0197: new ColorUIResource(213, 210, 202),
0198: "CollapsiblePaneTitlePane.foreground",
0199: new ColorUIResource(91, 91, 91),
0200: "CollapsiblePaneTitlePane.foreground.focus",
0201: new ColorUIResource(137, 137, 137),
0202: "CollapsiblePaneTitlePane.backgroundLt.emphasized",
0203: new ColorUIResource(68, 68, 68),
0204: "CollapsiblePaneTitlePane.backgroundDk.emphasized",
0205: new ColorUIResource(94, 94, 94),
0206: "CollapsiblePaneTitlePane.foreground.emphasized",
0207: new ColorUIResource(255, 255, 255),
0208: "CollapsiblePaneTitlePane.foreground.focus.emphasized",
0209: new ColorUIResource(230, 230, 230),
0210: "CollapsiblePane.downIcon",
0211: IconsFactory.getOverlayIcon(null, normalIcon,
0212: downMark, SwingConstants.CENTER),
0213: "CollapsiblePane.upIcon",
0214: IconsFactory.getOverlayIcon(null, normalIcon,
0215: upMark, SwingConstants.CENTER),
0216: "CollapsiblePane.downIcon.emphasized",
0217: IconsFactory.getOverlayIcon(null, emphasizedIcon,
0218: downMark, SwingConstants.CENTER),
0219: "CollapsiblePane.upIcon.emphasized",
0220: IconsFactory.getOverlayIcon(null, emphasizedIcon,
0221: upMark, SwingConstants.CENTER),
0222: "CollapsiblePane.upMask", upMark,
0223: "CollapsiblePane.downMask", downMark,
0224: "CollapsiblePane.titleButtonBackground",
0225: normalIcon,
0226: "CollapsiblePane.titleButtonBackground.emphasized",
0227: emphasizedIcon, };
0228: _normalTheme.putDefaults(uiDefaultsNormal);
0229: }
0230:
0231: Object uiDefaultsBlue[] = { "control",
0232: new ColorUIResource(196, 219, 249), "controlLt",
0233: new ColorUIResource(218, 234, 253), "controlDk",
0234: new ColorUIResource(129, 169, 226), "controlShadow",
0235: new ColorUIResource(59, 67, 156),
0236:
0237: "TabbedPane.selectDk",
0238: new ColorUIResource(230, 139, 44),
0239: "TabbedPane.selectLt",
0240: new ColorUIResource(255, 199, 60),
0241:
0242: "OptionPane.bannerLt", new ColorUIResource(0, 52, 206),
0243: "OptionPane.bannerDk",
0244: new ColorUIResource(45, 96, 249),
0245: "OptionPane.bannerForeground",
0246: new ColorUIResource(255, 255, 255),
0247:
0248: "Separator.foreground",
0249: new ColorUIResource(106, 140, 203),
0250: "Separator.foregroundLt",
0251: new ColorUIResource(241, 249, 255),
0252:
0253: "Gripper.foreground", new ColorUIResource(39, 65, 118),
0254: "Gripper.foregroundLt",
0255: new ColorUIResource(255, 255, 255),
0256:
0257: "Chevron.backgroundLt",
0258: new ColorUIResource(117, 166, 241),
0259: "Chevron.backgroundDk",
0260: new ColorUIResource(0, 53, 145),
0261:
0262: "Divider.backgroundLt",
0263: new ColorUIResource(89, 135, 214),
0264: "Divider.backgroundDk",
0265: new ColorUIResource(0, 45, 150),
0266:
0267: "backgroundLt", new ColorUIResource(195, 218, 249),
0268: "backgroundDk", new ColorUIResource(158, 190, 245),
0269:
0270: "selection.border", new ColorUIResource(0, 0, 128),
0271:
0272: "MenuItem.background",
0273: new ColorUIResource(246, 246, 246),
0274:
0275: "DockableFrameTitlePane.backgroundLt",
0276: new ColorUIResource(218, 234, 253),
0277: "DockableFrameTitlePane.backgroundDk",
0278: new ColorUIResource(123, 164, 224),
0279: "DockableFrameTitlePane.activeForeground",
0280: new ColorUIResource(0, 0, 0),
0281: "DockableFrameTitlePane.inactiveForeground",
0282: new ColorUIResource(0, 0, 0),
0283: "DockableFrame.backgroundLt",
0284: new ColorUIResource(221, 236, 254),
0285: "DockableFrame.backgroundDk",
0286: new ColorUIResource(221, 236, 254),
0287:
0288: "CommandBar.titleBarBackground",
0289: new ColorUIResource(42, 102, 201), };
0290: _blueTheme.putDefaults(uiDefaultsBlue);
0291:
0292: if ((products & LookAndFeelFactory.PRODUCT_COMPONENTS) != 0) {
0293: ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(
0294: Office2003WindowsUtils.class,
0295: "icons/collapsible_pane_blue.png"); // 20 x 20
0296: ImageIcon collapsiblePaneMask = IconsFactory.getImageIcon(
0297: Office2003WindowsUtils.class,
0298: "icons/collapsible_pane_mask.png"); // 11 x 11
0299: ImageIcon normalIcon = IconsFactory.getIcon(null,
0300: collapsiblePaneImage, 0, 0, SIZE, SIZE);
0301: ImageIcon emphasizedIcon = IconsFactory.getIcon(null,
0302: collapsiblePaneImage, SIZE, 0, SIZE, SIZE);
0303: ImageIcon upMark = IconsFactory.getIcon(null,
0304: collapsiblePaneMask, 0, 0, MASK_SIZE, MASK_SIZE);
0305: ImageIcon downMark = IconsFactory.getIcon(null,
0306: collapsiblePaneMask, 0, MASK_SIZE, MASK_SIZE,
0307: MASK_SIZE);
0308: uiDefaultsNormal = new Object[] {
0309: "CollapsiblePane.contentBackground",
0310: new ColorUIResource(214, 223, 247),
0311: "CollapsiblePanes.backgroundLt",
0312: new ColorUIResource(123, 162, 231),
0313: "CollapsiblePanes.backgroundDk",
0314: new ColorUIResource(103, 125, 217),
0315: "CollapsiblePaneTitlePane.backgroundLt",
0316: new ColorUIResource(255, 255, 255),
0317: "CollapsiblePaneTitlePane.backgroundDk",
0318: new ColorUIResource(198, 211, 247),
0319: "CollapsiblePaneTitlePane.foreground",
0320: new ColorUIResource(33, 93, 198),
0321: "CollapsiblePaneTitlePane.foreground.focus",
0322: new ColorUIResource(65, 142, 254),
0323: "CollapsiblePaneTitlePane.backgroundLt.emphasized",
0324: new ColorUIResource(0, 73, 181),
0325: "CollapsiblePaneTitlePane.backgroundDk.emphasized",
0326: new ColorUIResource(41, 93, 206),
0327:
0328: "CollapsiblePaneTitlePane.foreground.emphasized",
0329: new ColorUIResource(255, 255, 255),
0330: "CollapsiblePaneTitlePane.foreground.focus.emphasized",
0331: new ColorUIResource(65, 142, 254),
0332: "CollapsiblePane.downIcon",
0333: IconsFactory.getOverlayIcon(null, normalIcon,
0334: downMark, SwingConstants.CENTER),
0335: "CollapsiblePane.upIcon",
0336: IconsFactory.getOverlayIcon(null, normalIcon,
0337: upMark, SwingConstants.CENTER),
0338: "CollapsiblePane.downIcon.emphasized",
0339: IconsFactory.getOverlayIcon(null, emphasizedIcon,
0340: downMark, SwingConstants.CENTER),
0341: "CollapsiblePane.upIcon.emphasized",
0342: IconsFactory.getOverlayIcon(null, emphasizedIcon,
0343: upMark, SwingConstants.CENTER),
0344: "CollapsiblePane.upMask", upMark,
0345: "CollapsiblePane.downMask", downMark,
0346: "CollapsiblePane.titleButtonBackground",
0347: normalIcon,
0348: "CollapsiblePane.titleButtonBackground.emphasized",
0349: emphasizedIcon, };
0350: _blueTheme.putDefaults(uiDefaultsNormal);
0351: }
0352:
0353: // green theme
0354: Object uiDefaultsHomeStead[] = { "control",
0355: new ColorUIResource(209, 222, 173), "controlLt",
0356: new ColorUIResource(244, 247, 222), "controlDk",
0357: new ColorUIResource(183, 198, 145), "controlShadow",
0358: new ColorUIResource(96, 128, 88),
0359:
0360: "TabbedPane.selectDk",
0361: new ColorUIResource(207, 114, 37),
0362: "TabbedPane.selectLt",
0363: new ColorUIResource(227, 145, 79),
0364:
0365: "OptionPane.bannerLt",
0366: new ColorUIResource(150, 185, 120),
0367: "OptionPane.bannerDk",
0368: new ColorUIResource(179, 214, 149),
0369: "OptionPane.bannerForeground",
0370: new ColorUIResource(255, 255, 255),
0371:
0372: "Separator.foreground",
0373: new ColorUIResource(96, 128, 88),
0374: "Separator.foregroundLt",
0375: new ColorUIResource(244, 247, 242),
0376:
0377: "Gripper.foreground", new ColorUIResource(81, 94, 51),
0378: "Gripper.foregroundLt",
0379: new ColorUIResource(255, 255, 255),
0380:
0381: "Chevron.backgroundLt",
0382: new ColorUIResource(176, 194, 140),
0383: "Chevron.backgroundDk",
0384: new ColorUIResource(96, 119, 107),
0385:
0386: "Divider.backgroundLt",
0387: new ColorUIResource(120, 142, 111),
0388: "Divider.backgroundDk",
0389: new ColorUIResource(73, 91, 67),
0390:
0391: "backgroundLt", new ColorUIResource(242, 240, 228),
0392: "backgroundDk", new ColorUIResource(217, 217, 167),
0393:
0394: "selection.border", new ColorUIResource(63, 93, 56),
0395:
0396: "MenuItem.background",
0397: new ColorUIResource(244, 244, 238),
0398:
0399: "DockableFrameTitlePane.backgroundLt",
0400: new ColorUIResource(237, 242, 212),
0401: "DockableFrameTitlePane.backgroundDk",
0402: new ColorUIResource(181, 196, 143),
0403: "DockableFrameTitlePane.activeForeground",
0404: new ColorUIResource(0, 0, 0),
0405: "DockableFrameTitlePane.inactiveForeground",
0406: new ColorUIResource(0, 0, 0),
0407: "DockableFrame.backgroundLt",
0408: new ColorUIResource(243, 242, 231),
0409: "DockableFrame.backgroundDk",
0410: new ColorUIResource(243, 242, 231),
0411:
0412: "CommandBar.titleBarBackground",
0413: new ColorUIResource(116, 134, 94),
0414:
0415: };
0416: _homeSteadTheme.putDefaults(uiDefaultsHomeStead);
0417:
0418: if ((products & LookAndFeelFactory.PRODUCT_COMPONENTS) != 0) {
0419: ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(
0420: Office2003WindowsUtils.class,
0421: "icons/collapsible_pane_homestead.png"); // 20 x 20
0422: ImageIcon collapsiblePaneMask = IconsFactory.getImageIcon(
0423: Office2003WindowsUtils.class,
0424: "icons/collapsible_pane_mask.png"); // 11 x 11
0425: ImageIcon normalIcon = IconsFactory.getIcon(null,
0426: collapsiblePaneImage, 0, 0, SIZE, SIZE);
0427: ImageIcon emphasizedIcon = IconsFactory.getIcon(null,
0428: collapsiblePaneImage, SIZE, 0, SIZE, SIZE);
0429: ImageIcon upMark = IconsFactory.getIcon(null,
0430: collapsiblePaneMask, 0, 0, MASK_SIZE, MASK_SIZE);
0431: ImageIcon downMark = IconsFactory.getIcon(null,
0432: collapsiblePaneMask, 0, MASK_SIZE, MASK_SIZE,
0433: MASK_SIZE);
0434: uiDefaultsNormal = new Object[] {
0435: "CollapsiblePane.contentBackground",
0436: new ColorUIResource(246, 246, 246),
0437: "CollapsiblePanes.backgroundLt",
0438: new ColorUIResource(204, 217, 173),
0439: "CollapsiblePanes.backgroundDk",
0440: new ColorUIResource(165, 189, 132),
0441: "CollapsiblePaneTitlePane.backgroundLt",
0442: new ColorUIResource(254, 252, 236),
0443: "CollapsiblePaneTitlePane.backgroundDk",
0444: new ColorUIResource(224, 231, 184),
0445: "CollapsiblePaneTitlePane.foreground",
0446: new ColorUIResource(86, 102, 45),
0447: "CollapsiblePaneTitlePane.foreground.focus",
0448: new ColorUIResource(114, 146, 29),
0449: "CollapsiblePaneTitlePane.backgroundLt.emphasized",
0450: new ColorUIResource(119, 140, 64),
0451: "CollapsiblePaneTitlePane.backgroundDk.emphasized",
0452: new ColorUIResource(150, 168, 103),
0453: "CollapsiblePaneTitlePane.foreground.emphasized",
0454: new ColorUIResource(255, 255, 255),
0455: "CollapsiblePaneTitlePane.foreground.focus.emphasized",
0456: new ColorUIResource(224, 231, 151),
0457: "CollapsiblePane.downIcon",
0458: IconsFactory.getOverlayIcon(null, normalIcon,
0459: downMark, SwingConstants.CENTER),
0460: "CollapsiblePane.upIcon",
0461: IconsFactory.getOverlayIcon(null, normalIcon,
0462: upMark, SwingConstants.CENTER),
0463: "CollapsiblePane.downIcon.emphasized",
0464: IconsFactory.getOverlayIcon(null, emphasizedIcon,
0465: downMark, SwingConstants.CENTER),
0466: "CollapsiblePane.upIcon.emphasized",
0467: IconsFactory.getOverlayIcon(null, emphasizedIcon,
0468: upMark, SwingConstants.CENTER),
0469: "CollapsiblePane.upMask", upMark,
0470: "CollapsiblePane.downMask", downMark,
0471: "CollapsiblePane.titleButtonBackground",
0472: normalIcon,
0473: "CollapsiblePane.titleButtonBackground.emphasized",
0474: emphasizedIcon, };
0475: _homeSteadTheme.putDefaults(uiDefaultsNormal);
0476: }
0477:
0478: Object uiDefaultsMetallic[] = { "control",
0479: new ColorUIResource(219, 218, 228), "controlLt",
0480: new ColorUIResource(243, 244, 250), "controlDk",
0481: new ColorUIResource(153, 151, 181), "controlShadow",
0482: new ColorUIResource(124, 124, 148),
0483:
0484: "TabbedPane.selectDk",
0485: new ColorUIResource(230, 139, 44),
0486: "TabbedPane.selectLt",
0487: new ColorUIResource(255, 200, 60),
0488:
0489: "OptionPane.bannerLt",
0490: new ColorUIResource(181, 195, 222),
0491: "OptionPane.bannerDk",
0492: new ColorUIResource(120, 140, 167),
0493: "OptionPane.bannerForeground",
0494: new ColorUIResource(255, 255, 255),
0495:
0496: "Separator.foreground",
0497: new ColorUIResource(110, 109, 143),
0498: "Separator.foregroundLt",
0499: new ColorUIResource(255, 255, 255),
0500:
0501: "Gripper.foreground", new ColorUIResource(84, 84, 117),
0502: "Gripper.foregroundLt",
0503: new ColorUIResource(255, 255, 255),
0504:
0505: "Chevron.backgroundLt",
0506: new ColorUIResource(179, 178, 200),
0507: "Chevron.backgroundDk",
0508: new ColorUIResource(118, 116, 146),
0509:
0510: "Divider.backgroundLt",
0511: new ColorUIResource(168, 167, 191),
0512: "Divider.backgroundDk",
0513: new ColorUIResource(119, 118, 151),
0514:
0515: "backgroundLt", new ColorUIResource(243, 243, 247),
0516: "backgroundDk", new ColorUIResource(215, 215, 229),
0517:
0518: "selection.border", new ColorUIResource(75, 75, 111),
0519:
0520: "MenuItem.background",
0521: new ColorUIResource(253, 250, 255),
0522:
0523: "DockableFrameTitlePane.backgroundLt",
0524: new ColorUIResource(240, 240, 248),
0525: "DockableFrameTitlePane.backgroundDk",
0526: new ColorUIResource(147, 145, 176),
0527: "DockableFrameTitlePane.activeForeground",
0528: new ColorUIResource(0, 0, 0),
0529: "DockableFrameTitlePane.inactiveForeground",
0530: new ColorUIResource(0, 0, 0),
0531: "DockableFrame.backgroundLt",
0532: new ColorUIResource(238, 238, 244),
0533: "DockableFrame.backgroundDk",
0534: new ColorUIResource(238, 238, 244),
0535:
0536: "CommandBar.titleBarBackground",
0537: new ColorUIResource(122, 121, 153), };
0538: _metallicTheme.putDefaults(uiDefaultsMetallic);
0539:
0540: if ((products & LookAndFeelFactory.PRODUCT_COMPONENTS) != 0) {
0541: ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(
0542: Office2003WindowsUtils.class,
0543: "icons/collapsible_pane_metallic.png"); // 20 x 20
0544: ImageIcon collapsiblePaneMask = IconsFactory.getImageIcon(
0545: Office2003WindowsUtils.class,
0546: "icons/collapsible_pane_mask.png"); // 11 x 11
0547: ImageIcon normalIcon = IconsFactory.getIcon(null,
0548: collapsiblePaneImage, 0, 0, SIZE, SIZE);
0549: ImageIcon emphasizedIcon = IconsFactory.getIcon(null,
0550: collapsiblePaneImage, SIZE, 0, SIZE, SIZE);
0551: ImageIcon upMark = IconsFactory.getIcon(null,
0552: collapsiblePaneMask, 0, 0, MASK_SIZE, MASK_SIZE);
0553: ImageIcon downMark = IconsFactory.getIcon(null,
0554: collapsiblePaneMask, 0, MASK_SIZE, MASK_SIZE,
0555: MASK_SIZE);
0556: uiDefaultsNormal = new Object[] {
0557: "CollapsiblePane.contentBackground",
0558: new ColorUIResource(240, 241, 245),
0559: "CollapsiblePanes.backgroundLt",
0560: new ColorUIResource(196, 200, 212),
0561: "CollapsiblePanes.backgroundDk",
0562: new ColorUIResource(177, 179, 200),
0563: "CollapsiblePaneTitlePane.backgroundLt",
0564: new ColorUIResource(255, 255, 255),
0565: "CollapsiblePaneTitlePane.backgroundDk",
0566: new ColorUIResource(214, 215, 224),
0567: "CollapsiblePaneTitlePane.foreground",
0568: new ColorUIResource(63, 61, 61),
0569: "CollapsiblePaneTitlePane.foreground.focus",
0570: new ColorUIResource(126, 124, 124),
0571: "CollapsiblePaneTitlePane.backgroundLt.emphasized",
0572: new ColorUIResource(119, 119, 145),
0573: "CollapsiblePaneTitlePane.backgroundDk.emphasized",
0574: new ColorUIResource(180, 182, 199),
0575: "CollapsiblePaneTitlePane.foreground.emphasized",
0576: new ColorUIResource(255, 255, 255),
0577: "CollapsiblePaneTitlePane.foreground.focus.emphasized",
0578: new ColorUIResource(230, 230, 230),
0579:
0580: "CollapsiblePane.downIcon",
0581: IconsFactory.getOverlayIcon(null, normalIcon,
0582: downMark, SwingConstants.CENTER),
0583: "CollapsiblePane.upIcon",
0584: IconsFactory.getOverlayIcon(null, normalIcon,
0585: upMark, SwingConstants.CENTER),
0586: "CollapsiblePane.downIcon.emphasized",
0587: IconsFactory.getOverlayIcon(null, emphasizedIcon,
0588: downMark, SwingConstants.CENTER),
0589: "CollapsiblePane.upIcon.emphasized",
0590: IconsFactory.getOverlayIcon(null, emphasizedIcon,
0591: upMark, SwingConstants.CENTER),
0592: "CollapsiblePane.upMask", upMark,
0593: "CollapsiblePane.downMask", downMark,
0594: "CollapsiblePane.titleButtonBackground",
0595: normalIcon,
0596: "CollapsiblePane.titleButtonBackground.emphasized",
0597: emphasizedIcon, };
0598: _metallicTheme.putDefaults(uiDefaultsNormal);
0599: }
0600: }
0601:
0602: protected Office2003Painter() {
0603: }
0604:
0605: public void addTheme(Office2003Theme theme) {
0606: _themeCache.put(theme.getThemeName(), theme);
0607: }
0608:
0609: public Office2003Theme getTheme(String themeName) {
0610: return _themeCache.get(themeName);
0611: }
0612:
0613: public void removeTheme(String themeName) {
0614: _themeCache.remove(themeName);
0615: }
0616:
0617: public Collection<Office2003Theme> getAvailableThemes() {
0618: return _themeCache.values();
0619: }
0620:
0621: @Override
0622: public void installDefaults() {
0623: }
0624:
0625: @Override
0626: public void uninstallDefaults() {
0627: }
0628:
0629: public String getColorName() {
0630: return _colorName;
0631: }
0632:
0633: public void setColorName(String colorName) {
0634: _colorName = colorName;
0635: }
0636:
0637: public static boolean isNative() {
0638: return _native;
0639: }
0640:
0641: public static void setNative(boolean aNative) {
0642: _native = aNative;
0643: }
0644:
0645: public Office2003Theme getCurrentTheme() {
0646: if (getColorName() == null
0647: || getColorName().trim().length() == 0
0648: || _themeCache.get(getColorName()) == null) {
0649: return _themeCache.get(XPUtils.DEFAULT);
0650: } else {
0651: return _themeCache.get(getColorName());
0652: }
0653: }
0654:
0655: @Override
0656: public void paintButtonBackground(JComponent c, Graphics g,
0657: Rectangle rect, int orientation, int state,
0658: boolean showBorder) {
0659: Color startColor = null;
0660: Color endColor = null;
0661: Color background = null;
0662: switch (state) {
0663: case STATE_DEFAULT:
0664: background = c.getBackground();
0665: if (!(background instanceof UIResource)) {
0666: startColor = ColorUtils.getDerivedColor(background,
0667: 0.6f);
0668: endColor = ColorUtils.getDerivedColor(background, 0.4f);
0669: showBorder = false;
0670: } else {
0671: startColor = getCurrentTheme().getColor("controlLt");
0672: endColor = getCurrentTheme().getColor("controlDk");
0673: }
0674:
0675: break;
0676: case STATE_ROLLOVER:
0677: if (c instanceof ComponentStateSupport) {
0678: background = ((ComponentStateSupport) c)
0679: .getBackgroundOfState(state);
0680: }
0681: if (background != null
0682: && !(background instanceof UIResource)) {
0683: startColor = ColorUtils.getDerivedColor(background,
0684: 0.6f);
0685: endColor = ColorUtils.getDerivedColor(background, 0.4f);
0686: } else {
0687: startColor = getCurrentTheme().getColor(
0688: "selection.RolloverLt");
0689: endColor = getCurrentTheme().getColor(
0690: "selection.RolloverDk");
0691: }
0692: break;
0693: case STATE_SELECTED:
0694: if (c instanceof ComponentStateSupport) {
0695: background = ((ComponentStateSupport) c)
0696: .getBackgroundOfState(state);
0697: }
0698: if (background != null
0699: && !(background instanceof UIResource)) {
0700: startColor = ColorUtils.getDerivedColor(background,
0701: 0.6f);
0702: endColor = ColorUtils.getDerivedColor(background, 0.4f);
0703: } else {
0704: startColor = getCurrentTheme().getColor(
0705: "selection.SelectedLt");
0706: endColor = getCurrentTheme().getColor(
0707: "selection.SelectedDk");
0708: }
0709: break;
0710: case STATE_PRESSED:
0711: if (c instanceof ComponentStateSupport) {
0712: background = ((ComponentStateSupport) c)
0713: .getBackgroundOfState(state);
0714: }
0715: if (background != null
0716: && !(background instanceof UIResource)) {
0717: startColor = ColorUtils.getDerivedColor(background,
0718: 0.4f);
0719: endColor = ColorUtils.getDerivedColor(background, 0.6f);
0720: } else {
0721: startColor = getCurrentTheme().getColor(
0722: "selection.PressedDk");
0723: endColor = getCurrentTheme().getColor(
0724: "selection.PressedLt");
0725: }
0726: break;
0727: }
0728:
0729: if (startColor != null && endColor != null) {
0730: paintBackground(c, (Graphics2D) g, rect,
0731: showBorder ? getCurrentTheme().getColor(
0732: "selection.border") : null, startColor,
0733: endColor, orientation);
0734: }
0735: }
0736:
0737: protected void paintBackground(JComponent c, Graphics2D g2d,
0738: Rectangle rect, Color borderColor, Color startColor,
0739: Color endColor, int orientation) {
0740: if (borderColor != null) {
0741: if (startColor != null && endColor != null) {
0742: JideSwingUtilities.fillGradient(g2d, new Rectangle(
0743: rect.x + 1, rect.y + 1, rect.width - 1,
0744: rect.height - 1), startColor, endColor,
0745: orientation == SwingConstants.HORIZONTAL);
0746: }
0747: boolean paintDefaultBorder = true;
0748: Object o = c
0749: .getClientProperty("JideButton.paintDefaultBorder");
0750: if (o instanceof Boolean) {
0751: paintDefaultBorder = (Boolean) o;
0752: }
0753: if (paintDefaultBorder) {
0754: Color oldColor = g2d.getColor();
0755: g2d.setColor(borderColor);
0756: g2d.drawRect(rect.x, rect.y, rect.width - 1,
0757: rect.height - 1);
0758: g2d.setColor(oldColor);
0759: }
0760: } else {
0761: if (startColor != null && endColor != null) {
0762: JideSwingUtilities.fillGradient(g2d, new Rectangle(
0763: rect.x, rect.y, rect.width, rect.height),
0764: startColor, endColor,
0765: orientation == SwingConstants.HORIZONTAL);
0766: }
0767: }
0768: }
0769:
0770: @Override
0771: public void paintChevronBackground(JComponent c, Graphics g,
0772: Rectangle rect, int orientation, int state) {
0773: Graphics2D g2d = (Graphics2D) g;
0774: if (state == STATE_DEFAULT) {
0775: paintChevron(orientation, getCurrentTheme().getColor(
0776: "Chevron.backgroundLt"), getCurrentTheme()
0777: .getColor("Chevron.backgroundDk"), rect, g2d);
0778: } else if (state == STATE_ROLLOVER) {
0779: paintChevron(orientation, getCurrentTheme().getColor(
0780: "selection.RolloverLt"), getCurrentTheme()
0781: .getColor("selection.RolloverDk"), rect, g2d);
0782: } else if (state == STATE_SELECTED) {
0783: paintChevron(orientation, getCurrentTheme().getColor(
0784: "selection.SelectedDk"), getCurrentTheme()
0785: .getColor("selection.SelectedLt"), rect, g2d);
0786: } else if (state == STATE_PRESSED) {
0787: paintChevron(orientation, getCurrentTheme().getColor(
0788: "selection.PressedDk"), getCurrentTheme().getColor(
0789: "selection.PressedLt"), rect, g2d);
0790: }
0791: }
0792:
0793: @Override
0794: public void paintDividerBackground(JComponent c, Graphics g,
0795: Rectangle rect, int orientation, int state) {
0796: Graphics2D g2d = (Graphics2D) g;
0797: JideSwingUtilities.fillGradient(g2d, rect, getCurrentTheme()
0798: .getColor("Divider.backgroundLt"), getCurrentTheme()
0799: .getColor("Divider.backgroundDk"), true);
0800: }
0801:
0802: protected void paintChevron(int orientation, Color color1,
0803: Color color2, Rectangle rect, Graphics2D g2d) {
0804: if (orientation == SwingConstants.HORIZONTAL) {
0805: // don't use fast gradient painter as it has some problem
0806: JideSwingUtilities.fillGradient(g2d, new Rectangle(
0807: rect.x + 2, rect.y + 2, rect.width - 2,
0808: rect.height - 4), color1, color2, true);
0809: g2d.setColor(color1);
0810: g2d.drawLine(rect.x, rect.y, rect.x + rect.width - 3,
0811: rect.y);
0812: g2d.drawLine(rect.x + 1, rect.y + 1, rect.x + rect.width
0813: - 2, rect.y + 1);
0814: g2d.setColor(color2);
0815: g2d.drawLine(rect.x + 1, rect.y + rect.height - 2, rect.x
0816: + rect.width - 2, rect.y + rect.height - 2);
0817: g2d.drawLine(rect.x, rect.y + rect.height - 1, rect.x
0818: + rect.width - 3, rect.y + rect.height - 1);
0819: } else {
0820: // don't use fast gradient painter as it has some problem
0821: JideSwingUtilities.fillGradient(g2d, new Rectangle(
0822: rect.x + 2, rect.y + 2, rect.width - 4,
0823: rect.height - 2), color1, color2, false);
0824: g2d.setColor(color1);
0825: g2d.drawLine(rect.x, rect.y, rect.x, rect.y + rect.height
0826: - 3);
0827: g2d.drawLine(rect.x + 1, rect.y + 1, rect.x + 1, rect.y
0828: + rect.height - 2);
0829: g2d.setColor(color2);
0830: g2d.drawLine(rect.x + rect.width - 2, rect.y + 1, rect.x
0831: + rect.width - 2, rect.y + rect.height - 2);
0832: g2d.drawLine(rect.x + rect.width - 1, rect.y, rect.x
0833: + rect.width - 1, rect.y + rect.height - 3);
0834: }
0835: }
0836:
0837: @Override
0838: public Color getColor(Object key) {
0839: return getCurrentTheme().getColor(key);
0840: }
0841:
0842: @Override
0843: public void paintCommandBarBackground(JComponent c, Graphics g,
0844: Rectangle rect, int orientation, int state) {
0845: Graphics2D g2d = (Graphics2D) g;
0846: JideSwingUtilities.fillGradient(g2d,
0847: new RoundRectangle2D.Float(rect.x, rect.y, rect.width,
0848: rect.height, 4, 4), getCurrentTheme().getColor(
0849: "controlLt"), getCurrentTheme().getColor(
0850: "controlDk"),
0851: orientation == SwingConstants.HORIZONTAL);
0852: g2d.setColor(getCurrentTheme().getColor("controlShadow"));
0853: if (orientation == SwingConstants.HORIZONTAL) {
0854: g2d.drawLine(rect.x + 2, rect.y + rect.height - 1, rect.x
0855: + rect.width - 3, rect.y + rect.height - 1);
0856: } else {
0857: g2d.drawLine(rect.x + rect.width - 1, rect.y + 2, rect.x
0858: + rect.width - 1, rect.y + rect.height - 3);
0859: }
0860: }
0861:
0862: @Override
0863: public void paintFloatingCommandBarBackground(JComponent c,
0864: Graphics g, Rectangle rect, int orientation, int state) {
0865: Graphics2D g2d = (Graphics2D) g;
0866: JideSwingUtilities.fillGradient(g2d, rect, getCurrentTheme()
0867: .getColor("controlLt"), getCurrentTheme().getColor(
0868: "controlDk"), orientation == SwingConstants.HORIZONTAL);
0869: }
0870:
0871: @Override
0872: public void paintMenuShadow(JComponent c, Graphics g,
0873: Rectangle rect, int orientation, int state) {
0874: Graphics2D g2d = (Graphics2D) g;
0875: JideSwingUtilities.fillGradient(g2d, rect, getCurrentTheme()
0876: .getColor("controlLt"), getCurrentTheme().getColor(
0877: "controlDk"), orientation != SwingConstants.HORIZONTAL);
0878: }
0879:
0880: @Override
0881: public Color getControl() {
0882: return getCurrentTheme().getColor("control");
0883: }
0884:
0885: @Override
0886: public Color getControlLt() {
0887: return getCurrentTheme().getColor("controlLt");
0888: }
0889:
0890: @Override
0891: public Color getControlDk() {
0892: return getCurrentTheme().getColor("controlDk");
0893: }
0894:
0895: @Override
0896: public Color getControlShadow() {
0897: return getCurrentTheme().getColor("controlShadow");
0898: }
0899:
0900: @Override
0901: public Color getGripperForeground() {
0902: return getCurrentTheme().getColor("Gripper.foreground");
0903: }
0904:
0905: @Override
0906: public Color getGripperForegroundLt() {
0907: return getCurrentTheme().getColor("Gripper.foregroundLt");
0908: }
0909:
0910: @Override
0911: public Color getSeparatorForeground() {
0912: return getCurrentTheme().getColor("Separator.foreground");
0913: }
0914:
0915: @Override
0916: public Color getSeparatorForegroundLt() {
0917: return getCurrentTheme().getColor("Separator.foregroundLt");
0918: }
0919:
0920: @Override
0921: public Color getCollapsiblePaneContentBackground() {
0922: return getCurrentTheme().getColor(
0923: "CollapsiblePane.contentBackground");
0924: }
0925:
0926: @Override
0927: public Color getCollapsiblePaneTitleForeground() {
0928: return getCurrentTheme().getColor(
0929: "CollapsiblePaneTitlePane.foreground");
0930: }
0931:
0932: @Override
0933: public Color getCollapsiblePaneFocusTitleForeground() {
0934: return getCurrentTheme().getColor(
0935: "CollapsiblePaneTitlePane.foreground.focus");
0936: }
0937:
0938: @Override
0939: public Color getCollapsiblePaneTitleForegroundEmphasized() {
0940: return getCurrentTheme().getColor(
0941: "CollapsiblePaneTitlePane.foreground.emphasized");
0942: }
0943:
0944: @Override
0945: public Color getCollapsiblePaneFocusTitleForegroundEmphasized() {
0946: return getCurrentTheme().getColor(
0947: "CollapsiblePaneTitlePane.foreground.focus.emphasized");
0948: }
0949:
0950: @Override
0951: public ImageIcon getCollapsiblePaneUpIcon() {
0952: return (ImageIcon) getCurrentTheme().getIcon(
0953: "CollapsiblePane.upIcon");
0954: }
0955:
0956: @Override
0957: public ImageIcon getCollapsiblePaneDownIcon() {
0958: return (ImageIcon) getCurrentTheme().getIcon(
0959: "CollapsiblePane.downIcon");
0960: }
0961:
0962: @Override
0963: public ImageIcon getCollapsiblePaneUpIconEmphasized() {
0964: return (ImageIcon) getCurrentTheme().getIcon(
0965: "CollapsiblePane.upIcon.emphasized");
0966: }
0967:
0968: @Override
0969: public ImageIcon getCollapsiblePaneDownIconEmphasized() {
0970: return (ImageIcon) getCurrentTheme().getIcon(
0971: "CollapsiblePane.downIcon.emphasized");
0972: }
0973:
0974: @Override
0975: public ImageIcon getCollapsiblePaneTitleButtonBackground() {
0976: return (ImageIcon) getCurrentTheme().getIcon(
0977: "CollapsiblePane.titleButtonBackground");
0978: }
0979:
0980: @Override
0981: public ImageIcon getCollapsiblePaneTitleButtonBackgroundEmphasized() {
0982: return (ImageIcon) getCurrentTheme().getIcon(
0983: "CollapsiblePane.titleButtonBackground.emphasized");
0984: }
0985:
0986: @Override
0987: public ImageIcon getCollapsiblePaneUpMask() {
0988: return (ImageIcon) getCurrentTheme().getIcon(
0989: "CollapsiblePane.upMask");
0990: }
0991:
0992: @Override
0993: public ImageIcon getCollapsiblePaneDownMask() {
0994: return (ImageIcon) getCurrentTheme().getIcon(
0995: "CollapsiblePane.downMask");
0996: }
0997:
0998: @Override
0999: public Color getBackgroundDk() {
1000: return getCurrentTheme().getColor("backgroundDk");
1001: }
1002:
1003: @Override
1004: public Color getBackgroundLt() {
1005: return getCurrentTheme().getColor("backgroundLt");
1006: }
1007:
1008: @Override
1009: public Color getSelectionSelectedDk() {
1010: return getCurrentTheme().getColor("selection.SelectedDk");
1011: }
1012:
1013: @Override
1014: public Color getSelectionSelectedLt() {
1015: return getCurrentTheme().getColor("selection.SelectedLt");
1016: }
1017:
1018: @Override
1019: public Color getMenuItemBorderColor() {
1020: return getCurrentTheme().getColor("selection.border");
1021: }
1022:
1023: @Override
1024: public Color getMenuItemBackground() {
1025: return getCurrentTheme().getColor("MenuItem.background");
1026: }
1027:
1028: @Override
1029: public Color getCommandBarTitleBarBackground() {
1030: return getCurrentTheme().getColor(
1031: "CommandBar.titleBarBackground");
1032: }
1033:
1034: @Override
1035: public Color getDockableFrameTitleBarActiveForeground() {
1036: return getCurrentTheme().getColor(
1037: "DockableFrameTitlePane.activeForeground");
1038: }
1039:
1040: @Override
1041: public Color getDockableFrameTitleBarInactiveForeground() {
1042: return getCurrentTheme().getColor(
1043: "DockableFrameTitlePane.inactiveForeground");
1044: }
1045:
1046: @Override
1047: public Color getTitleBarBackground() {
1048: return getCurrentTheme().getColor(
1049: "DockableFrameTitlePane.backgroundDk");
1050: }
1051:
1052: public Color getOptionPanebannerForeground() {
1053: return getCurrentTheme()
1054: .getColor("OptionPane.bannerForeground");
1055: }
1056:
1057: @Override
1058: public Color getTabbedPaneSelectDk() {
1059: return getCurrentTheme().getColor("TabbedPane.selectDk");
1060: }
1061:
1062: @Override
1063: public Color getTabbedPaneSelectLt() {
1064: return getCurrentTheme().getColor("TabbedPane.selectLt");
1065: }
1066:
1067: @Override
1068: public Color getOptionPaneBannerDk() {
1069: return getCurrentTheme().getColor("OptionPane.bannerDk");
1070: }
1071:
1072: @Override
1073: public Color getOptionPaneBannerLt() {
1074: return getCurrentTheme().getColor("OptionPane.bannerLt");
1075: }
1076:
1077: @Override
1078: public void paintContentBackground(JComponent c, Graphics g,
1079: Rectangle rect, int orientation, int state) {
1080: Graphics2D g2d = (Graphics2D) g;
1081: JideSwingUtilities.fillGradient(g2d, rect, getBackgroundDk(),
1082: getBackgroundLt(), false);
1083: }
1084:
1085: @Override
1086: public void paintGripper(JComponent c, Graphics g, Rectangle rect,
1087: int orientation, int state) {
1088: if (rect.width > 30) {
1089: orientation = SwingConstants.VERTICAL;
1090: } else if (rect.height > 30) {
1091: orientation = SwingConstants.HORIZONTAL;
1092: }
1093:
1094: int h = (orientation == SwingConstants.HORIZONTAL) ? rect.height
1095: : rect.width;
1096: int count = Math.min(9, (h - 6) / 4);
1097: int y = rect.y;
1098: int x = rect.x;
1099:
1100: if (orientation == SwingConstants.HORIZONTAL) {
1101: y += rect.height / 2 - count * 2;
1102: x += rect.width / 2 - 1;
1103: } else {
1104: x += rect.width / 2 - count * 2;
1105: y += rect.height / 2 - 1;
1106: }
1107:
1108: for (int i = 0; i < count; i++) {
1109: g.setColor(getGripperForegroundLt());
1110: g.fillRect(x + 1, y + 1, 2, 2);
1111: g.setColor(getGripperForeground());
1112: g.fillRect(x, y, 2, 2);
1113: if (orientation == SwingConstants.HORIZONTAL) {
1114: y += 4;
1115: } else {
1116: x += 4;
1117: }
1118: }
1119: }
1120:
1121: @Override
1122: public void paintChevronMore(JComponent c, Graphics g,
1123: Rectangle rect, int orientation, int state) {
1124: int startX = rect.x + 4;
1125: int startY = rect.x + 5;
1126:
1127: int oppositeOrientation = orientation == SwingConstants.HORIZONTAL ? SwingConstants.VERTICAL
1128: : SwingConstants.HORIZONTAL;
1129:
1130: if (orientation == SwingConstants.HORIZONTAL) {
1131: startX++;
1132: startY++;
1133: JideSwingUtilities.paintArrow(g, Color.WHITE, startX,
1134: startY, 3, oppositeOrientation);
1135: startX += 4;
1136: JideSwingUtilities.paintArrow(g, Color.WHITE, startX,
1137: startY, 3, oppositeOrientation);
1138: startX--;
1139: startX -= 4;
1140: startY--;
1141: JideSwingUtilities.paintArrow(g, Color.BLACK, startX,
1142: startY, 3, oppositeOrientation);
1143: startX += 4;
1144: JideSwingUtilities.paintArrow(g, Color.BLACK, startX,
1145: startY, 3, oppositeOrientation);
1146: } else {
1147: startX++;
1148: startY++;
1149: JideSwingUtilities.paintArrow(g, Color.WHITE, startX,
1150: startY, 3, oppositeOrientation);
1151: startY += 4;
1152: JideSwingUtilities.paintArrow(g, Color.WHITE, startX,
1153: startY, 3, oppositeOrientation);
1154: startX--;
1155: startY--;
1156: startY -= 4;
1157: JideSwingUtilities.paintArrow(g, Color.BLACK, startX,
1158: startY, 3, oppositeOrientation);
1159: startY += 4;
1160: JideSwingUtilities.paintArrow(g, Color.BLACK, startX,
1161: startY, 3, oppositeOrientation);
1162: }
1163: }
1164:
1165: @Override
1166: public void paintChevronOption(JComponent c, Graphics g,
1167: Rectangle rect, int orientation, int state) {
1168: int startX;
1169: int startY;
1170: if (orientation == SwingConstants.HORIZONTAL) {
1171: startX = rect.x + rect.width - 8;
1172: startY = rect.y + rect.height - 10;
1173: } else {
1174: startX = rect.x + rect.width - 10;
1175: startY = rect.y + rect.height - 8;
1176: }
1177:
1178: startX++;
1179: startY++;
1180: paintDown(g, Color.WHITE, startX, startY, orientation);
1181:
1182: startX--;
1183: startY--;
1184: paintDown(g, Color.BLACK, startX, startY, orientation);
1185: }
1186:
1187: private void paintDown(Graphics g, Color color, int startX,
1188: int startY, int orientation) {
1189: g.setColor(color);
1190: if (orientation == SwingConstants.HORIZONTAL) {
1191: g.drawLine(startX, startY, startX + 4, startY);
1192: JideSwingUtilities.paintArrow(g, color, startX, startY + 3,
1193: 5, orientation);
1194: } else {
1195: g.drawLine(startX, startY, startX, startY + 4);
1196: JideSwingUtilities.paintArrow(g, color, startX + 3, startY,
1197: 5, orientation);
1198: }
1199: }
1200:
1201: @Override
1202: public void paintDockableFrameBackground(JComponent c, Graphics g,
1203: Rectangle rect, int orientation, int state) {
1204: Graphics2D g2d = (Graphics2D) g;
1205: JideSwingUtilities.fillGradient(g2d, new Rectangle(rect.x,
1206: rect.y, rect.width, rect.height), getCurrentTheme()
1207: .getColor("DockableFrame.backgroundLt"),
1208: getCurrentTheme()
1209: .getColor("DockableFrame.backgroundDk"),
1210: orientation == SwingConstants.HORIZONTAL);
1211: }
1212:
1213: @Override
1214: public void paintDockableFrameTitlePane(JComponent c, Graphics g,
1215: Rectangle rect, int orientation, int state) {
1216: int x = rect.x;
1217: int y = rect.y;
1218: int w = rect.width;
1219: int h = rect.height;
1220: if (c.getBorder() != null) {
1221: Insets insets = c.getBorder().getBorderInsets(c);
1222: x += insets.left;
1223: y += insets.top;
1224: w -= insets.right + insets.left;
1225: h -= insets.top + insets.bottom;
1226: }
1227: rect = new Rectangle(x, y, w, h);
1228:
1229: boolean active = state == STATE_SELECTED;
1230: Graphics2D g2d = (Graphics2D) g;
1231: JideSwingUtilities.fillGradient(g2d, rect,
1232: active ? getCurrentTheme().getColor(
1233: "selection.SelectedLt")
1234: : getCurrentTheme().getColor(
1235: "DockableFrameTitlePane.backgroundLt"),
1236: active ? getCurrentTheme().getColor(
1237: "selection.SelectedDk")
1238: : getCurrentTheme().getColor(
1239: "DockableFrameTitlePane.backgroundDk"),
1240: orientation == SwingConstants.HORIZONTAL);
1241: }
1242:
1243: @Override
1244: public void paintCollapsiblePaneTitlePaneBackground(JComponent c,
1245: Graphics g, Rectangle rect, int orientation, int state) {
1246: Graphics2D g2d = (Graphics2D) g;
1247: Color colorLt = getCurrentTheme().getColor(
1248: "CollapsiblePaneTitlePane.backgroundLt");
1249: Color colorDk = getCurrentTheme().getColor(
1250: "CollapsiblePaneTitlePane.backgroundDk");
1251: Color old = g.getColor();
1252: g.setColor(colorLt);
1253: g
1254: .drawLine(rect.x, rect.y + 2, rect.x, rect.y
1255: + rect.height - 1);
1256: g.drawLine(rect.x + 1, rect.y + 1, rect.x + 1, rect.y
1257: + rect.height - 1);
1258: JideSwingUtilities.fillGradient(g2d, new Rectangle(rect.x + 2,
1259: rect.y, rect.width - 4, rect.height), colorLt, colorDk,
1260: orientation == SwingConstants.VERTICAL);
1261: g.setColor(colorDk);
1262: g.drawLine(rect.x + rect.width - 2, rect.y + 1, rect.x
1263: + rect.width - 2, rect.y + rect.height - 1);
1264: g.drawLine(rect.x + rect.width - 1, rect.y + 2, rect.x
1265: + rect.width - 1, rect.y + rect.height - 1);
1266: g.setColor(old);
1267: }
1268:
1269: @Override
1270: public void paintCollapsiblePaneTitlePaneBackgroundEmphasized(
1271: JComponent c, Graphics g, Rectangle rect, int orientation,
1272: int state) {
1273: Graphics2D g2d = (Graphics2D) g;
1274: Color colorLt = getCurrentTheme().getColor(
1275: "CollapsiblePaneTitlePane.backgroundLt.emphasized");
1276: Color colorDk = getCurrentTheme().getColor(
1277: "CollapsiblePaneTitlePane.backgroundDk.emphasized");
1278: g.setColor(colorLt);
1279: g
1280: .drawLine(rect.x, rect.y + 2, rect.x, rect.y
1281: + rect.height - 1);
1282: g.drawLine(rect.x + 1, rect.y + 1, rect.x + 1, rect.y
1283: + rect.height - 1);
1284: JideSwingUtilities.fillGradient(g2d, new Rectangle(rect.x + 2,
1285: rect.y, rect.width - 4, rect.height), colorLt, colorDk,
1286: orientation == SwingConstants.VERTICAL);
1287: g.setColor(colorDk);
1288: g.drawLine(rect.x + rect.width - 2, rect.y + 1, rect.x
1289: + rect.width - 2, rect.y + rect.height - 1);
1290: g.drawLine(rect.x + rect.width - 1, rect.y + 2, rect.x
1291: + rect.width - 1, rect.y + rect.height - 1);
1292: }
1293:
1294: @Override
1295: public void paintCollapsiblePanesBackground(JComponent c,
1296: Graphics g, Rectangle rect, int orientation, int state) {
1297: Graphics2D g2d = (Graphics2D) g;
1298: JideSwingUtilities.fillGradient(g2d, new Rectangle(rect.x,
1299: rect.y, rect.width, rect.height), getCurrentTheme()
1300: .getColor("CollapsiblePanes.backgroundLt"),
1301: getCurrentTheme().getColor(
1302: "CollapsiblePanes.backgroundDk"),
1303: orientation == SwingConstants.HORIZONTAL);
1304:
1305: }
1306:
1307: @Override
1308: public void paintCollapsiblePaneTitlePaneBackgroundPlainEmphasized(
1309: JComponent c, Graphics g, Rectangle rect, int orientation,
1310: int state) {
1311: Graphics2D g2d = (Graphics2D) g;
1312: Color colorLt = getCurrentTheme().getColor(
1313: "CollapsiblePaneTitlePane.backgroundLt.emphasized");
1314: Color colorDk = getCurrentTheme().getColor(
1315: "CollapsiblePaneTitlePane.backgroundDk.emphasized");
1316: JideSwingUtilities.fillGradient(g2d, new Rectangle(rect.x,
1317: rect.y + rect.height - 1, rect.width, 1), colorLt,
1318: colorDk, orientation == SwingConstants.HORIZONTAL);
1319: }
1320:
1321: @Override
1322: public void paintCollapsiblePaneTitlePaneBackgroundPlain(
1323: JComponent c, Graphics g, Rectangle rect, int orientation,
1324: int state) {
1325: Graphics2D g2d = (Graphics2D) g;
1326: Color colorLt = getCurrentTheme().getColor(
1327: "CollapsiblePaneTitlePane.backgroundLt");
1328: Color colorDk = getCurrentTheme().getColor(
1329: "CollapsiblePaneTitlePane.backgroundDk");
1330: JideSwingUtilities.fillGradient(g2d, new Rectangle(rect.x,
1331: rect.y + rect.height - 1, rect.width, 1), colorLt,
1332: colorDk, orientation == SwingConstants.HORIZONTAL);
1333: }
1334: }
|