Source Code Cross Referenced for XertoPainter.java in  » Swing-Library » jide-common » com » jidesoft » plaf » xerto » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » jide common » com.jidesoft.plaf.xerto 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)XertoPainter.java 3/22/2005
003:         *
004:         * Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
005:         */
006:        package com.jidesoft.plaf.xerto;
007:
008:        import com.jidesoft.icons.IconsFactory;
009:        import com.jidesoft.plaf.basic.BasicPainter;
010:        import com.jidesoft.plaf.basic.ThemePainter;
011:        import com.jidesoft.swing.JideSwingUtilities;
012:
013:        import javax.swing.*;
014:        import java.awt.*;
015:
016:        /**
017:         * Painter for Xerto L&F.
018:         * <p/>
019:         * Please note, this class is an internal class which is meant to be used by other JIDE classes only.
020:         * Future version might break your build if you use it.
021:         */
022:        public class XertoPainter extends BasicPainter {
023:
024:            private static XertoPainter _instance;
025:            private final static ImageIcon SELECTED = IconsFactory
026:                    .getImageIcon(XertoPainter.class, "icons/selected.gif");
027:            private final static ImageIcon SELECTED_C = IconsFactory
028:                    .getImageIcon(XertoPainter.class, "icons/selected_c.gif");
029:            private final static ImageIcon ROLLOVER = IconsFactory
030:                    .getImageIcon(XertoPainter.class, "icons/rollover.gif");
031:            private final static ImageIcon ROLLOVER_C = IconsFactory
032:                    .getImageIcon(XertoPainter.class, "icons/rollover_c.gif");
033:            private final static ImageIcon PRESSED = IconsFactory.getImageIcon(
034:                    XertoPainter.class, "icons/pressed.gif");
035:            private final static ImageIcon PRESSED_C = IconsFactory
036:                    .getImageIcon(XertoPainter.class, "icons/pressed_c.gif");
037:
038:            public static ThemePainter getInstance() {
039:                if (_instance == null) {
040:                    _instance = new XertoPainter();
041:                }
042:                return _instance;
043:            }
044:
045:            protected XertoPainter() {
046:            }
047:
048:            //    public void paintContentBackground(JComponent c, Graphics g, Rectangle rect, int orientation, int state) {
049:            //        JideSwingUtilities.fillGradient((Graphics2D) g, rect,
050:            //                XertoUtils.getMidControlColor(), XertoUtils.getControlColor(), false);
051:            //    }
052:            //
053:
054:            @Override
055:            public void paintCollapsiblePaneTitlePaneBackground(JComponent c,
056:                    Graphics g, Rectangle rect, int orientation, int state) {
057:                Graphics2D g2d = (Graphics2D) g;
058:                Color gradientBot = c.getBackground();
059:                Color gradientTop = XertoUtils.getHeighlightColor(gradientBot);
060:                JideSwingUtilities.fillGradient(g2d, rect, gradientTop,
061:                        gradientBot, true);
062:            }
063:
064:            @Override
065:            public void paintCollapsiblePaneTitlePaneBackgroundEmphasized(
066:                    JComponent c, Graphics g, Rectangle rect, int orientation,
067:                    int state) {
068:                Graphics2D g2d = (Graphics2D) g;
069:                Color gradientBot = XertoUtils
070:                        .getEmBaseColor(c.getBackground());
071:                Color gradientTop = c.getBackground();
072:                JideSwingUtilities.fillGradient(g2d, rect, gradientTop,
073:                        gradientBot, true);
074:            }
075:
076:            @Override
077:            public void paintMenuItemBackground(JComponent c, Graphics g,
078:                    Rectangle rect, int orientation, int state,
079:                    boolean showBorder) {
080:                super .paintMenuItemBackground(c, g, rect, orientation, state,
081:                        showBorder);
082:            }
083:
084:            @Override
085:            public void paintButtonBackground(JComponent c, Graphics g,
086:                    Rectangle rect, int orientation, int state) {
087:                if (state == STATE_DEFAULT) {
088:                    super .paintButtonBackground(c, g, rect, orientation, state);
089:                } else if (state == STATE_ROLLOVER) {
090:                    paintImageBorder(g, rect, ROLLOVER, ROLLOVER_C, null);
091:                } else if (state == STATE_SELECTED) {
092:                    paintImageBorder(g, rect, SELECTED, SELECTED_C, Color.WHITE);
093:                } else if (state == STATE_PRESSED) {
094:                    paintImageBorder(g, rect, PRESSED, PRESSED_C, null);
095:                }
096:            }
097:
098:            private void paintImageBorder(Graphics g, Rectangle rect,
099:                    ImageIcon icon, ImageIcon center, Color background) {
100:                JideSwingUtilities.drawImageBorder(g, icon, rect, new Insets(4,
101:                        4, 4, 4), false);
102:
103:                if (center == null) {
104:                    Color oldColor = g.getColor();
105:                    g.setColor(background);
106:                    g.fillRect(rect.x + 4, rect.y + 4, rect.width - 8,
107:                            rect.height - 8);
108:                    g.setColor(oldColor);
109:                } else {
110:                    g.drawImage(center.getImage(), rect.x + 4, rect.y + 4,
111:                            rect.x + rect.width - 4, rect.y + rect.height - 4,
112:                            0, 0, center.getIconWidth(),
113:                            center.getIconHeight(), background, null);
114:                }
115:            }
116:
117:            @Override
118:            public void paintGripper(JComponent c, Graphics g, Rectangle rect,
119:                    int orientation, int state) {
120:                if (rect.width > 30) {
121:                    orientation = SwingConstants.VERTICAL;
122:                }
123:
124:                int h = (orientation == SwingConstants.HORIZONTAL) ? rect.height
125:                        : rect.width;
126:                int count = Math.min(9, (h - 6) / 4);
127:                int y = rect.y;
128:                int x = rect.x;
129:
130:                if (orientation == SwingConstants.HORIZONTAL) {
131:                    y += rect.height / 2 - count * 2;
132:                    x += rect.width / 2 - 1;
133:                } else {
134:                    x += rect.width / 2 - count * 2;
135:                    y += rect.height / 2 - 1;
136:                }
137:
138:                for (int i = 0; i < count; i++) {
139:                    g.setColor(getGripperForegroundLt());
140:                    g.fillRect(x + 1, y + 1, 2, 2);
141:                    g.setColor(XertoUtils.getControlMidShadowColor());
142:                    g.fillRect(x, y, 2, 2);
143:                    g.setColor(XertoUtils.getControlLightShadowColor());
144:                    g.fillRect(x, y, 1, 1);
145:                    g.setColor(XertoUtils.getControlDarkShadowColor());
146:                    g.fillRect(x + 1, y + 1, 1, 1);
147:
148:                    if (orientation == SwingConstants.HORIZONTAL) {
149:                        y += 4;
150:                    } else {
151:                        x += 4;
152:                    }
153:                }
154:            }
155:
156:            @Override
157:            public void paintDockableFrameTitlePane(JComponent c, Graphics g,
158:                    Rectangle rect, int orientation, int state) {
159:                Graphics2D g2d = (Graphics2D) g;
160:                if (ThemePainter.STATE_SELECTED == state) {
161:                    JideSwingUtilities.fillGradient(g2d, new Rectangle(rect.x,
162:                            rect.y, rect.width, rect.height), XertoUtils
163:                            .getFrameActiveTitleTopColor(), XertoUtils
164:                            .getFrameActiveTitleBottomColor(),
165:                            orientation == SwingConstants.HORIZONTAL);
166:                } else {
167:                    JideSwingUtilities.fillGradient(g2d, new Rectangle(rect.x,
168:                            rect.y, rect.width, rect.height), XertoUtils
169:                            .getFrameInactiveTitleTopColor(), XertoUtils
170:                            .getFrameInactiveTitleBottomColor(),
171:                            orientation == SwingConstants.HORIZONTAL);
172:                }
173:            }
174:
175:            @Override
176:            public Color getGripperForeground() {
177:                return XertoUtils.getControlLightShadowColor();
178:            }
179:
180:            @Override
181:            public Color getGripperForegroundLt() {
182:                return Color.WHITE;
183:            }
184:
185:            @Override
186:            public Color getSelectionSelectedDk() {
187:                return XertoUtils.getControlMidShadowColor();
188:            }
189:
190:            @Override
191:            public Color getSelectionSelectedLt() {
192:                return XertoUtils.getControlLightShadowColor();
193:            }
194:
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.