Source Code Cross Referenced for AquaJideTabbedPaneUI.java in  » Swing-Library » jide-common » com » jidesoft » plaf » aqua » 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.aqua 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)WindowsTabbedPaneUI.java
003:         *
004:         * Copyright 2002 JIDE Software Inc. All rights reserved.
005:         */
006:
007:        package com.jidesoft.plaf.aqua;
008:
009:        import com.jidesoft.plaf.vsnet.VsnetJideTabbedPaneUI;
010:
011:        import javax.swing.*;
012:        import javax.swing.plaf.ComponentUI;
013:        import java.awt.*;
014:
015:        /**
016:         * JideTabbedPane UI implementation
017:         */
018:        public class AquaJideTabbedPaneUI extends VsnetJideTabbedPaneUI {
019:            public static ComponentUI createUI(JComponent c) {
020:                return new AquaJideTabbedPaneUI();
021:            }
022:
023:            @Override
024:            protected void paintTabBackground(Graphics g, int tabPlacement,
025:                    int tabIndex, int x, int y, int w, int h, boolean isSelected) {
026:                super .paintTabBackground(g, tabPlacement, tabIndex, x, y, w, h,
027:                        isSelected);
028:
029:                if (_tabPane.getTabColorProvider() != null) {
030:                    return;
031:                }
032:
033:                if (!PAINT_TAB_BACKGROUND) {
034:                    return;
035:                }
036:
037:                if (!isSelected) {
038:                    return;
039:                }
040:
041:                Color[] color = AquaJideUtils.isGraphite() ? AquaJideUtils.AQUA_GRAPHITE
042:                        : AquaJideUtils.AQUA_BLUE;
043:
044:                if (tabRegion != null) {
045:                    Graphics2D g2d = (Graphics2D) g;
046:                    switch (tabPlacement) {
047:                    case LEFT:
048:                        AquaJideUtils.fillAquaGradientVertical(g2d, tabRegion,
049:                                color);
050:                        break;
051:                    case RIGHT:
052:                        AquaJideUtils.fillAquaGradientVertical(g2d, tabRegion,
053:                                color);
054:                        break;
055:                    case BOTTOM:
056:                        AquaJideUtils.fillAquaGradientHorizontal(g2d,
057:                                tabRegion, color);
058:                        break;
059:                    case TOP:
060:                    default:
061:                        AquaJideUtils.fillAquaGradientHorizontal(g2d,
062:                                tabRegion, color);
063:                        break;
064:                    }
065:
066:                }
067:            }
068:
069:            @Override
070:            protected void paintFocusIndicator(Graphics g, int tabPlacement,
071:                    Rectangle[] rects, int tabIndex, Rectangle iconRect,
072:                    Rectangle textRect, boolean isSelected) {
073:                // no focus rect here
074:            }
075:
076:            @Override
077:            protected boolean isRoundedCorner() {
078:                return true;
079:            }
080:
081:            protected boolean isShading() {
082:                return true;
083:            }
084:
085:            @Override
086:            protected Color getBorderEdgeColor() {
087:                return _shadow;
088:            }
089:
090:            @Override
091:            protected TabCloseButton createNoFocusButton(int type) {
092:                return new AquaTabCloseButton(type);
093:            }
094:
095:            private static final Color COLOR1 = new Color(130, 130, 130);
096:            private static final Color COLOR2 = new Color(86, 86, 86);
097:            private static final Color COLOR3 = new Color(252, 252, 252);
098:
099:            public class AquaTabCloseButton extends TabCloseButton {
100:                /**
101:                 * Resets the UI property to a value from the current look and
102:                 * feel.
103:                 *
104:                 * @see JComponent#updateUI
105:                 */
106:                @Override
107:                public void updateUI() {
108:                    super .updateUI();
109:                    setMargin(new Insets(0, 0, 0, 0));
110:                    setBorder(BorderFactory.createEmptyBorder());
111:                    setFocusPainted(false);
112:                }
113:
114:                public AquaTabCloseButton() {
115:                    this (CLOSE_BUTTON);
116:                }
117:
118:                public AquaTabCloseButton(int type) {
119:                    addMouseMotionListener(this );
120:                    addMouseListener(this );
121:                    setContentAreaFilled(false);
122:                    setType(type);
123:                }
124:
125:                @Override
126:                public Dimension getPreferredSize() {
127:                    return new Dimension(16, 16);
128:                }
129:
130:                @Override
131:                public Dimension getMinimumSize() {
132:                    return new Dimension(5, 5);
133:                }
134:
135:                @Override
136:                public Dimension getMaximumSize() {
137:                    return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
138:                }
139:
140:                @Override
141:                protected void paintComponent(Graphics g) {
142:                    if (!isEnabled()) {
143:                        setMouseOver(false);
144:                        setMousePressed(false);
145:                    }
146:
147:                    // draw "icons" antialiased
148:                    AquaJideUtils.antialiasShape(g, true);
149:
150:                    Color color = g.getColor();
151:
152:                    if (isMouseOver() && isMousePressed()) {
153:                        g.setColor(COLOR1);
154:                        g.fillOval(1, 2, getWidth() - 3, getHeight() - 4);
155:                        g.setColor(COLOR2);
156:                    } else if (isMouseOver()) {
157:                        g.setColor(COLOR1);
158:                        g.fillOval(1, 2, getWidth() - 3, getHeight() - 4);
159:                        g.setColor(COLOR3);
160:                    } else {
161:                        g.setColor(COLOR1);
162:                    }
163:                    int centerX = getWidth() >> 1;
164:                    int centerY = getHeight() >> 1;
165:                    switch (getType()) {
166:                    case CLOSE_BUTTON:
167:                        if (isEnabled()) {
168:                            g.drawLine(centerX - 2, centerY - 2, centerX + 2,
169:                                    centerY + 2);
170:                            g.drawLine(centerX - 3, centerY - 2, centerX + 1,
171:                                    centerY + 2);
172:                            g.drawLine(centerX + 2, centerY - 2, centerX - 2,
173:                                    centerY + 2);
174:                            g.drawLine(centerX + 1, centerY - 2, centerX - 3,
175:                                    centerY + 2);
176:                        } else {
177:                            g.drawLine(centerX - 3, centerY - 3, centerX + 3,
178:                                    centerY + 3);
179:                            g.drawLine(centerX + 3, centerY - 3, centerX - 3,
180:                                    centerY + 3);
181:                        }
182:                        break;
183:                    case EAST_BUTTON:
184:                        //  a bit smaller on Aqua
185:                        //
186:                        //  |
187:                        //  ||
188:                        //  |||
189:                        //  |||*
190:                        //  |||
191:                        //  ||
192:                        //  |
193:                        //
194:                    {
195:                        if (_tabPane.getTabPlacement() == TOP
196:                                || _tabPane.getTabPlacement() == BOTTOM) {
197:                            int x = centerX + 2, y = centerY; // start point. mark as * above
198:                            if (isEnabled()) {
199:                                g.drawLine(x - 3, y - 3, x - 3, y + 3);
200:                                g.drawLine(x - 2, y - 2, x - 2, y + 2);
201:                                g.drawLine(x - 1, y - 1, x - 1, y + 1);
202:                                g.drawLine(x, y, x, y);
203:                            } else {
204:                                g.drawLine(x - 3, y - 3, x, y);
205:                                g.drawLine(x - 3, y - 3, x - 3, y + 3);
206:                                g.drawLine(x - 3, y + 3, x, y);
207:                            }
208:                        } else {
209:                            int x = centerX, y = centerY + 2; // start point. mark as * above
210:                            if (isEnabled()) {
211:                                g.drawLine(x - 3, y - 3, x + 3, y - 3);
212:                                g.drawLine(x - 2, y - 2, x + 2, y - 2);
213:                                g.drawLine(x - 1, y - 1, x + 1, y - 1);
214:                                g.drawLine(x, y, x, y);
215:                            } else {
216:                                g.drawLine(x - 3, y - 3, x, y);
217:                                g.drawLine(x - 3, y - 3, x + 3, y - 3);
218:                                g.drawLine(x + 3, y - 3, x, y);
219:                            }
220:                        }
221:                    }
222:                        break;
223:                    case WEST_BUTTON: {
224:                        // a bit smaller on Aqua
225:                        //
226:                        //     |
227:                        //    ||
228:                        //   |||
229:                        //  *|||
230:                        //   |||
231:                        //    ||
232:                        //     |
233:                        //
234:                        //
235:                        {
236:                            if (_tabPane.getTabPlacement() == TOP
237:                                    || _tabPane.getTabPlacement() == BOTTOM) {
238:                                int x = centerX - 3, y = centerY; // start point. mark as * above
239:                                if (isEnabled()) {
240:                                    g.drawLine(x, y, x, y);
241:                                    g.drawLine(x + 1, y - 1, x + 1, y + 1);
242:                                    g.drawLine(x + 2, y - 2, x + 2, y + 2);
243:                                    g.drawLine(x + 3, y - 3, x + 3, y + 3);
244:                                } else {
245:                                    g.drawLine(x, y, x + 3, y - 3);
246:                                    g.drawLine(x, y, x + 3, y + 3);
247:                                    g.drawLine(x + 3, y - 3, x + 3, y + 3);
248:                                }
249:                            } else {
250:                                int x = centerX, y = centerY - 2; // start point. mark as * above
251:                                if (isEnabled()) {
252:                                    g.drawLine(x, y, x, y);
253:                                    g.drawLine(x - 1, y + 1, x + 1, y + 1);
254:                                    g.drawLine(x - 2, y + 2, x + 2, y + 2);
255:                                    g.drawLine(x - 3, y + 3, x + 3, y + 3);
256:                                } else {
257:                                    g.drawLine(x, y, x - 3, y + 3);
258:                                    g.drawLine(x, y, x + 3, y + 3);
259:                                    g.drawLine(x - 3, y + 3, x + 3, y + 3);
260:                                }
261:                            }
262:                        }
263:                        break;
264:                    }
265:                    case LIST_BUTTON: {
266:                        int x = centerX, y = centerY + 2; // start point. mark as * above
267:                        g.drawLine(x - 3, y - 3, x + 3, y - 3);
268:                        g.drawLine(x - 2, y - 2, x + 2, y - 2);
269:                        g.drawLine(x - 1, y - 1, x + 1, y - 1);
270:                        g.drawLine(x, y, x, y);
271:                        break;
272:                    }
273:                    }
274:
275:                    g.setColor(color);
276:                    // Disable antialiasing for shapes
277:                    AquaJideUtils.antialiasShape(g, false);
278:                }
279:
280:                @Override
281:                public boolean isOpaque() {
282:                    return false;
283:                }
284:            }
285:
286:            @Override
287:            protected void prepareEditor(TabEditor e, int tabIndex) {
288:                ((JTextField) e).setOpaque(true);
289:                super.prepareEditor(e, tabIndex);
290:            }
291:
292:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.