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


001:        /*
002:         * @(#)$FileName Copyright 2002 - 2004 JIDE Software Inc. All rights reserved.
003:         */
004:
005:        package com.jidesoft.plaf.office2003;
006:
007:        import com.jidesoft.plaf.UIDefaultsLookup;
008:        import com.jidesoft.plaf.vsnet.VsnetJideTabbedPaneUI;
009:        import com.jidesoft.swing.JideSwingUtilities;
010:        import com.jidesoft.swing.JideTabbedPane;
011:
012:        import javax.swing.*;
013:        import javax.swing.plaf.ComponentUI;
014:        import java.awt.*;
015:
016:        /**
017:         * JideTabbedPane UI implementation
018:         */
019:        public class Office2003JideTabbedPaneUI extends VsnetJideTabbedPaneUI {
020:            @Override
021:            public void installColorTheme() {
022:                super .installColorTheme();
023:
024:                if (_tabPane.getColorTheme() != JideTabbedPane.COLOR_THEME_OFFICE2003)
025:                    return;
026:
027:                switch (getTabShape()) {
028:                case JideTabbedPane.SHAPE_ROUNDED_FLAT:
029:                    _selectColor1 = getPainter().getControlShadow();
030:                    _selectColor2 = getPainter().getControlShadow();
031:                    _unselectColor1 = _selectColor1;
032:                    _unselectColor2 = _selectColor2;
033:                    break;
034:                case JideTabbedPane.SHAPE_BOX:
035:                    _selectColor1 = getPainter().getControlShadow();
036:                    _selectColor2 = getPainter().getControlShadow();
037:                    _unselectColor1 = getPainter().getControlShadow();
038:                    _unselectColor2 = _lightHighlight;
039:                    break;
040:                case JideTabbedPane.SHAPE_EXCEL:
041:                    _selectColor1 = getPainter().getControlShadow();
042:                    _selectColor2 = null;
043:                    _selectColor3 = null;
044:                    _unselectColor1 = getPainter().getControlShadow();
045:                    _unselectColor2 = null;
046:                    _unselectColor3 = null;
047:                    break;
048:                case JideTabbedPane.SHAPE_WINDOWS:
049:                case JideTabbedPane.SHAPE_WINDOWS_SELECTED:
050:                    _selectColor1 = _lightHighlight;
051:                    _selectColor2 = getPainter().getControlDk();
052:                    _selectColor3 = getPainter().getControlShadow();
053:                    _unselectColor1 = _selectColor1;
054:                    _unselectColor2 = _selectColor2;
055:                    _unselectColor3 = _selectColor3;
056:                    break;
057:                case JideTabbedPane.SHAPE_VSNET:
058:                    _selectColor1 = getPainter().getControlShadow();
059:                    _selectColor2 = getPainter().getControlShadow();
060:                    _unselectColor1 = getPainter().getControlShadow();
061:                    break;
062:                case JideTabbedPane.SHAPE_OFFICE2003:
063:                default:
064:                    _selectColor1 = getPainter().getControlShadow();
065:                    _unselectColor1 = getPainter().getControlShadow();
066:                    _unselectColor2 = _lightHighlight;
067:                    _unselectColor3 = getPainter().getControlDk();
068:                    break;
069:                }
070:
071:                installBackgroundColor();
072:            }
073:
074:            @Override
075:            protected void installBackgroundColor() {
076:                if (_tabPane.getColorTheme() == JideTabbedPane.COLOR_THEME_OFFICE2003) {
077:                    if (_showFocusIndicator) {
078:                        _backgroundSelectedColorStart = getPainter()
079:                                .getSelectionSelectedLt();
080:                        _backgroundSelectedColorEnd = getPainter()
081:                                .getSelectionSelectedDk();
082:                    } else {
083:                        _backgroundSelectedColorStart = getPainter()
084:                                .getBackgroundLt();
085:                        _backgroundSelectedColorEnd = getPainter()
086:                                .getBackgroundDk();
087:                    }
088:                    if (getTabShape() == JideTabbedPane.SHAPE_BOX) {
089:                        _backgroundUnselectedColorStart = null;
090:                        _backgroundUnselectedColorEnd = null;
091:                    } else {
092:                        _backgroundUnselectedColorStart = getPainter()
093:                                .getBackgroundLt();
094:                        _backgroundUnselectedColorEnd = getPainter()
095:                                .getBackgroundDk();
096:                    }
097:                } else {
098:                    super .installBackgroundColor();
099:                }
100:            }
101:
102:            // paint the background of the _tabScroller
103:            @Override
104:            public void paintBackground(Graphics g, Component c) {
105:                if (_tabPane.isOpaque()) {
106:                    int width = c.getWidth();
107:                    int height = c.getHeight();
108:                    int h = 0;
109:                    int w = 0;
110:                    Graphics2D g2d = (Graphics2D) g;
111:
112:                    if (_tabPane.getTabCount() > 0) {
113:                        h = _tabPane.getBoundsAt(0).height;
114:                        w = _tabPane.getBoundsAt(0).width;
115:                    } else {
116:                        return;
117:                    }
118:
119:                    int temp1 = -1;
120:                    int temp2 = -1;
121:                    if (isTabLeadingComponentVisible()) {
122:                        if (h < _tabLeadingComponent.getSize().height) {
123:                            h = _tabLeadingComponent.getSize().height;
124:                            temp1 = _tabLeadingComponent.getSize().height;
125:                        }
126:                        if (w < _tabLeadingComponent.getSize().width) {
127:                            w = _tabLeadingComponent.getSize().width;
128:                            temp2 = _tabLeadingComponent.getSize().width;
129:                        }
130:                    }
131:
132:                    if (isTabTrailingComponentVisible()) {
133:                        if (h < _tabTrailingComponent.getSize().height
134:                                && temp1 < _tabTrailingComponent.getSize().height) {
135:                            h = _tabTrailingComponent.getSize().height;
136:                        }
137:                        if (w < _tabTrailingComponent.getSize().width
138:                                && temp2 < _tabTrailingComponent.getSize().width) {
139:                            w = _tabTrailingComponent.getSize().width;
140:                        }
141:                    }
142:
143:                    super .paintBackground(g, c);
144:
145:                    if (getTabShape() != JideTabbedPane.SHAPE_BOX) {// the color set is office2003
146:                        Rectangle rect = null;
147:                        if (_tabPane.getTabPlacement() == TOP) {
148:                            rect = new Rectangle(0, 0, width, h + 2);
149:
150:                        } else if (_tabPane.getTabPlacement() == BOTTOM) {
151:                            rect = new Rectangle(0, height - h - 2, width,
152:                                    h + 2);
153:
154:                        } else if (_tabPane.getTabPlacement() == LEFT) {
155:                            rect = new Rectangle(0, 0, w + 2, height);
156:
157:                        } else if (_tabPane.getTabPlacement() == RIGHT) {
158:                            rect = new Rectangle(width - w - 2, 0, w + 2,
159:                                    height);
160:                        }
161:                        if (rect != null) {
162:                            paintTabAreaBackground(g, rect, _tabPane
163:                                    .getTabPlacement());
164:                        }
165:                    } else {
166:                        super .paintBackground(g, c);
167:                    }
168:                }
169:            }
170:
171:            public static ComponentUI createUI(JComponent c) {
172:                return new Office2003JideTabbedPaneUI();
173:            }
174:
175:            @Override
176:            protected void paintTabAreaBackground(Graphics g, Rectangle rect,
177:                    int tabPlacement) {
178:                if (getColorTheme() != JideTabbedPane.COLOR_THEME_OFFICE2003) {
179:                    super .paintTabAreaBackground(g, rect, tabPlacement);
180:                } else {
181:                    // set color of the tab area
182:                    if (_tabPane.isOpaque()) {
183:                        if (getTabShape() != JideTabbedPane.SHAPE_BOX) {
184:                            Graphics2D g2d = (Graphics2D) g;
185:                            Color startColor = getPainter()
186:                                    .getTabAreaBackgroundDk();
187:                            Color endColor = getPainter()
188:                                    .getTabAreaBackgroundLt();
189:                            if (_tabPane.getTabPlacement() == TOP) {
190:                                JideSwingUtilities.fillGradient(g2d,
191:                                        new Rectangle(rect.x, rect.y,
192:                                                rect.width, rect.height),
193:                                        startColor, endColor, true);
194:                            } else if (_tabPane.getTabPlacement() == BOTTOM) {
195:                                JideSwingUtilities.fillGradient(g2d,
196:                                        new Rectangle(rect.x, rect.y,
197:                                                rect.width, rect.height),
198:                                        endColor, startColor, true);
199:                            } else if (_tabPane.getTabPlacement() == LEFT) {
200:                                JideSwingUtilities.fillGradient(g2d,
201:                                        new Rectangle(rect.x, rect.y,
202:                                                rect.width, rect.height),
203:                                        startColor, endColor, false);
204:                            } else if (_tabPane.getTabPlacement() == RIGHT) {
205:                                JideSwingUtilities.fillGradient(g2d,
206:                                        new Rectangle(rect.x, rect.y,
207:                                                rect.width, rect.height),
208:                                        endColor, startColor, false);
209:                            }
210:                        } else {
211:                            g.setColor(UIDefaultsLookup.getColor("control"));
212:                            g.fillRect(rect.x, rect.y, rect.width, rect.height);
213:                        }
214:                    }
215:                }
216:            }
217:
218:            // paint the content top line when the tab is on the top
219:            @Override
220:            protected void paintContentBorderTopEdge(Graphics g,
221:                    int tabPlacement, int selectedIndex, int x, int y, int w,
222:                    int h) {
223:                if (!PAINT_CONTENT_BORDER_EDGE) {
224:                    return;
225:                }
226:
227:                if (getColorTheme() != JideTabbedPane.COLOR_THEME_OFFICE2003) {
228:                    super .paintContentBorderTopEdge(g, tabPlacement,
229:                            selectedIndex, x, y, w, h);
230:                    return;
231:                }
232:
233:                if (selectedIndex < 0) {
234:                    return;
235:                }
236:
237:                Rectangle selRect = getTabBounds(selectedIndex, _calcRect);
238:
239:                Rectangle viewRect = _tabScroller.viewport.getViewRect();
240:                Rectangle r = _rects[selectedIndex];
241:
242:                int tabShape = getTabShape();
243:
244:                Insets contentInsets = getContentBorderInsets(tabPlacement);
245:
246:                if (_tabPane.getColorTheme() == JideTabbedPane.COLOR_THEME_OFFICE2003) {
247:                    if (tabShape == JideTabbedPane.SHAPE_OFFICE2003) {
248:                        g.setColor(getPainter().getControlShadow());
249:
250:                        if (_alwaysShowLineBorder
251:                                || _tabPane.hasFocusComponent()) {
252:                            if (contentInsets.left > 0) {
253:                                g.drawLine(x, y, x, y + h - 1);// left
254:                            }
255:                            if (contentInsets.right > 0) {
256:                                g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);// right
257:                            }
258:                            if (contentInsets.bottom > 0) {
259:                                g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);// bottom
260:                            }
261:
262:                            if (contentInsets.top > 0) {
263:                                if (!_tabPane.isTabShown()
264:                                        || r.x >= viewRect.x + viewRect.width) {
265:                                    g.drawLine(x, y, x + w - 1, y);// top
266:                                } else {
267:                                    g.drawLine(x, y, selRect.x - selRect.height
268:                                            + 2, y);// top left
269:                                    g.drawLine(selRect.x + selRect.width, y, x
270:                                            + w - 1, y);// top right
271:                                }
272:                            }
273:                        } else if (_tabPane.isTabShown()) {
274:                            if (r.x >= viewRect.x + viewRect.width) {
275:                                g.drawLine(x, y, x + w - 1, y);// top
276:                            } else {
277:                                g.drawLine(x, y,
278:                                        selRect.x - selRect.height + 2, y);// top left
279:                                g.drawLine(selRect.x + selRect.width, y, x + w
280:                                        - 1, y);// top right
281:                            }
282:                        }
283:
284:                    } else if (tabShape == JideTabbedPane.SHAPE_EXCEL) {
285:                        g.setColor(getPainter().getControlShadow());
286:
287:                        g.drawLine(x, y, selRect.x - selRect.height / 2 + 4, y);// top left
288:
289:                        if (contentInsets.left > 0) {
290:                            g.drawLine(x, y, x, y + h - 1);// left
291:                        }
292:                        if (contentInsets.right > 0) {
293:                            g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);// right
294:                        }
295:                        if (contentInsets.bottom > 0) {
296:                            g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);// bottom
297:                        }
298:
299:                        if (!_tabPane.isTabShown()
300:                                || r.x >= viewRect.x + viewRect.width) {
301:                            g.drawLine(x, y, x + w - 1, y);// top
302:                        } else {
303:                            if (!_tabPane.isShowIconsOnTab()
304:                                    && !_tabPane.isUseDefaultShowIconsOnTab()) {
305:                                g.drawLine(selRect.x + selRect.width
306:                                        + selRect.height / 2 - 4, y, x + w - 1,
307:                                        y);// top right
308:                            } else {
309:                                g.drawLine(selRect.x + selRect.width
310:                                        + selRect.height / 2 - 6, y, x + w - 1,
311:                                        y);// top right
312:                            }
313:                        }
314:                    } else if (tabShape == JideTabbedPane.SHAPE_WINDOWS
315:                            || tabShape == JideTabbedPane.SHAPE_WINDOWS_SELECTED) {
316:                        g.setColor(getBorderEdgeColor());
317:
318:                        if (_tabPane.getColorTheme() == JideTabbedPane.COLOR_THEME_VSNET
319:                                || _tabPane.getColorTheme() == JideTabbedPane.COLOR_THEME_WINXP) {// the color set is winxp
320:                            g.drawLine(x, y, selRect.x - 2, y);// top left
321:                        } else {// the color set is default or office2003
322:                            g.drawLine(x, y, selRect.x - 1, y);// top left
323:                        }
324:
325:                        if (contentInsets.left > 0) {
326:                            g.drawLine(x, y, x, y + h - 1);// left
327:                        }
328:
329:                        if (!_tabPane.isTabShown()
330:                                || r.x >= viewRect.x + viewRect.width) {
331:                            g.setColor(_lightHighlight);
332:                            g.drawLine(x, y, x + w - 1, y);// top
333:                        } else {
334:                            g.setColor(_lightHighlight);
335:                            g.drawLine(selRect.x + selRect.width + 3, y, x + w
336:                                    - 1, y);// top right
337:                        }
338:
339:                        g.setColor(getPainter().getControlDk());
340:                        if (contentInsets.right > 0) {
341:                            g.drawLine(x + w - 2, y + 1, x + w - 2, y + h - 2);// right
342:                        }
343:                        if (contentInsets.bottom > 0) {
344:                            g.drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2);// bottom
345:                        }
346:
347:                        g.setColor(getPainter().getControlShadow());
348:                        if (contentInsets.right > 0) {
349:                            g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);// right
350:                        }
351:                        if (contentInsets.bottom > 0) {
352:                            g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);// bottom
353:                        }
354:                    } else {
355:                        super .paintContentBorderTopEdge(g, tabPlacement,
356:                                selectedIndex, x, y, w, h);
357:                    }
358:                } else {
359:                    super .paintContentBorderTopEdge(g, tabPlacement,
360:                            selectedIndex, x, y, w, h);
361:                }
362:            }
363:
364:            // paint the content bottom line when the tab is on the bottom
365:            @Override
366:            protected void paintContentBorderBottomEdge(Graphics g,
367:                    int tabPlacement, int selectedIndex, int x, int y, int w,
368:                    int h) {
369:                if (!PAINT_CONTENT_BORDER_EDGE) {
370:                    return;
371:                }
372:
373:                if (getColorTheme() != JideTabbedPane.COLOR_THEME_OFFICE2003) {
374:                    super .paintContentBorderBottomEdge(g, tabPlacement,
375:                            selectedIndex, x, y, w, h);
376:                    return;
377:                }
378:
379:                if (selectedIndex < 0) {
380:                    return;
381:                }
382:
383:                Rectangle selRect = getTabBounds(selectedIndex, _calcRect);
384:
385:                Rectangle viewRect = _tabScroller.viewport.getViewRect();
386:                Rectangle r = _rects[selectedIndex];
387:
388:                int tabShape = getTabShape();
389:
390:                Insets contentInsets = getContentBorderInsets(tabPlacement);
391:
392:                if (tabShape == JideTabbedPane.SHAPE_OFFICE2003) {
393:                    g.setColor(getPainter().getControlShadow());
394:
395:                    if (_alwaysShowLineBorder || _tabPane.hasFocusComponent()) {
396:                        if (contentInsets.left > 0) {
397:                            g.drawLine(x, y, x, y + h - 1);// left
398:                        }
399:                        if (contentInsets.right > 0) {
400:                            g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);// right
401:                        }
402:                        if (contentInsets.top > 0) {
403:                            g.drawLine(x, y, x + w - 1, y);// top
404:                        }
405:
406:                        if (contentInsets.bottom > 0) {
407:                            if (!_tabPane.isTabShown()
408:                                    || r.x >= viewRect.x + viewRect.width) {
409:                                g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);// bottom
410:                            } else {
411:                                g.drawLine(x, y + h - 1, selRect.x
412:                                        - selRect.height + 2, y + h - 1);// bottom left
413:                                g.drawLine(selRect.x + selRect.width,
414:                                        y + h - 1, x + w - 1, y + h - 1);// bottom right
415:                            }
416:                        }
417:                    } else if (_tabPane.isTabShown()) {
418:                        if (r.x >= viewRect.x + viewRect.width) {
419:                            g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);// bottom
420:                        } else {
421:                            g.drawLine(x, y + h - 1, selRect.x - selRect.height
422:                                    + 2, y + h - 1);// bottom left
423:                            g.drawLine(selRect.x + selRect.width, y + h - 1, x
424:                                    + w - 1, y + h - 1);// bottom right
425:                        }
426:                    }
427:                } else if (tabShape == JideTabbedPane.SHAPE_EXCEL) {
428:                    g.setColor(getPainter().getControlShadow());
429:
430:                    g.drawLine(x, y + h - 1,
431:                            selRect.x - selRect.height / 2 + 4, y + h - 1);// bottom left
432:
433:                    if (contentInsets.left > 0) {
434:                        g.drawLine(x, y, x, y + h - 1);// left
435:                    }
436:                    if (contentInsets.right > 0) {
437:                        g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);// right
438:                    }
439:                    if (contentInsets.top > 0) {
440:                        g.drawLine(x, y, x + w - 1, y);// top
441:                    }
442:
443:                    if (!_tabPane.isTabShown()
444:                            || r.x >= viewRect.x + viewRect.width) {
445:                        g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);// bottom
446:                    } else {
447:                        if (!_tabPane.isShowIconsOnTab()
448:                                && !_tabPane.isUseDefaultShowIconsOnTab()) {
449:                            g.drawLine(selRect.x + selRect.width
450:                                    + selRect.height / 2 - 4, y + h - 1, x + w
451:                                    - 1, y + h - 1);// bottom right
452:                        } else {
453:                            g.drawLine(selRect.x + selRect.width
454:                                    + selRect.height / 2 - 6, y + h - 1, x + w
455:                                    - 1, y + h - 1);// bottom right
456:                        }
457:                    }
458:                } else if (tabShape == JideTabbedPane.SHAPE_WINDOWS
459:                        || tabShape == JideTabbedPane.SHAPE_WINDOWS_SELECTED) {
460:                    g.setColor(getPainter().getControlShadow());
461:                    g.drawLine(x + 1, y + h - 1, selRect.x - 2, y + h - 1);
462:                    if (contentInsets.right > 0) {
463:                        g.drawLine(x + w - 1, y + h - 1, x + w - 1, y + 1);
464:                    }
465:
466:                    if (!_tabPane.isTabShown()
467:                            || r.x >= viewRect.x + viewRect.width) {
468:                        g.setColor(getPainter().getControlShadow());
469:                        g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
470:                    } else {
471:                        g.setColor(getPainter().getControlShadow());
472:                        g.drawLine(selRect.x + selRect.width, y + h - 1, x + w
473:                                - 1, y + h - 1);
474:                        g.setColor(getPainter().getControlDk());
475:                        g.drawLine(selRect.x + selRect.width, y + h - 2, x + w
476:                                - 2, y + h - 2);
477:
478:                        g.setColor(getPainter().getControlDk());
479:                        g.drawLine(x + 1, y + h - 2, selRect.x - 2, y + h - 2);
480:                        if (contentInsets.right > 0) {
481:                            g.drawLine(x + w - 2, y + 1, x + w - 2, y + h - 2);
482:                        }
483:                        g.drawLine(selRect.x + selRect.width - 1, y + h - 1,
484:                                selRect.x + selRect.width - 1, y + h - 1);
485:
486:                        //                g.setColor(new Color(255, 199, 115));
487:                        //                g.drawLine(selRect.x, y + h - 1, selRect.x + selRect.width - 3, y + h - 1);
488:                        //                g.drawLine(selRect.x, y + h - 2, selRect.x + selRect.width, y + h - 2);
489:
490:                        g.setColor(new Color(255, 255, 255));
491:                        g.drawLine(selRect.x - 1, y + h - 1, selRect.x - 1, y
492:                                + h - 1);
493:                        g.drawLine(selRect.x - 1, y + h - 2, selRect.x - 1, y
494:                                + h - 2);
495:
496:                        if (contentInsets.left > 0) {
497:                            g.drawLine(x, y, x, y + h - 2);
498:                        }
499:                        if (contentInsets.top > 0) {
500:                            g.drawLine(x, y, x + w - 2, y);
501:                        }
502:                    }
503:
504:                } else {
505:                    super .paintContentBorderBottomEdge(g, tabPlacement,
506:                            selectedIndex, x, y, w, h);
507:                }
508:            }
509:
510:            // paint the content left line when the tab is on the left
511:            @Override
512:            protected void paintContentBorderLeftEdge(Graphics g,
513:                    int tabPlacement, int selectedIndex, int x, int y, int w,
514:                    int h) {
515:
516:                if (!PAINT_CONTENT_BORDER_EDGE) {
517:                    return;
518:                }
519:
520:                if (getColorTheme() != JideTabbedPane.COLOR_THEME_OFFICE2003) {
521:                    super .paintContentBorderLeftEdge(g, tabPlacement,
522:                            selectedIndex, x, y, w, h);
523:                    return;
524:                }
525:
526:                if (selectedIndex < 0) {
527:                    return;
528:                }
529:
530:                Rectangle selRect = getTabBounds(selectedIndex, _calcRect);
531:
532:                Rectangle viewRect = _tabScroller.viewport.getViewRect();
533:                Rectangle r = _rects[selectedIndex];
534:
535:                int tabShape = getTabShape();
536:
537:                Insets contentInsets = getContentBorderInsets(tabPlacement);
538:
539:                if (tabShape == JideTabbedPane.SHAPE_OFFICE2003) {
540:                    g.setColor(getPainter().getControlShadow());
541:
542:                    if (_alwaysShowLineBorder || _tabPane.hasFocusComponent()) {
543:                        if (contentInsets.top > 0) {
544:                            g.drawLine(x, y, x + w - 1, y);// top
545:                        }
546:                        if (contentInsets.right > 0) {
547:                            g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);// right
548:                        }
549:                        if (contentInsets.bottom > 0) {
550:                            g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);// bottom
551:                        }
552:
553:                        if (contentInsets.left > 0) {
554:                            if (!_tabPane.isTabShown()
555:                                    || r.y >= viewRect.y + viewRect.height) {
556:                                g.drawLine(x, y, x, y + h - 1);// left
557:                            } else {
558:                                g.drawLine(x, y, x, selRect.y - selRect.width
559:                                        + 2);// left top
560:                                g.drawLine(x, selRect.y + selRect.height, x, y
561:                                        + h - 1);// left bottom
562:                            }
563:                        }
564:                    } else if (_tabPane.isTabShown()) {
565:                        if (r.y >= viewRect.y + viewRect.height) {
566:                            g.drawLine(x, y, x, y + h - 1);// left
567:                        } else {
568:                            g.drawLine(x, y, x, selRect.y - selRect.width + 2);// left top
569:                            g.drawLine(x, selRect.y + selRect.height, x, y + h
570:                                    - 1);// left bottom
571:                        }
572:                    }
573:                } else if (tabShape == JideTabbedPane.SHAPE_EXCEL) {
574:                    g.setColor(getPainter().getControlShadow());
575:
576:                    g.drawLine(x, y, x, selRect.y - selRect.width / 2 + 4);// left top
577:
578:                    if (contentInsets.top > 0) {
579:                        g.drawLine(x, y, x + w - 1, y);// top
580:                    }
581:                    if (contentInsets.right > 0) {
582:                        g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);// right
583:                    }
584:                    if (contentInsets.bottom > 0) {
585:                        g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);// bottom
586:                    }
587:
588:                    if (!_tabPane.isTabShown()
589:                            || r.y >= viewRect.y + viewRect.height) {
590:                        g.drawLine(x, y, x, y + h - 1);// left
591:                    } else {
592:                        g.drawLine(x, selRect.y + selRect.height
593:                                + selRect.width / 2 - 4, x, y + h - 1);// left bottom
594:                    }
595:                } else if (tabShape == JideTabbedPane.SHAPE_WINDOWS
596:                        || tabShape == JideTabbedPane.SHAPE_WINDOWS_SELECTED) {
597:                    g.setColor(getPainter().getControlShadow());
598:                    if (contentInsets.right > 0) {
599:                        g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);// right
600:                    }
601:                    if (contentInsets.bottom > 0) {
602:                        g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);// bottom
603:                    }
604:
605:                    g.setColor(getPainter().getControlDk());
606:                    g.drawLine(x + w - 2, y + 1, x + w - 2, y + h - 2);
607:                    g.drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2);
608:
609:                    g.setColor(new Color(255, 255, 255));
610:                    if (contentInsets.top > 0) {
611:                        g.drawLine(x, y, x + w - 2, y);// top
612:                    }
613:                    g.drawLine(x, y, x, selRect.y - 1);
614:
615:                    if (!_tabPane.isTabShown()
616:                            || r.y >= viewRect.y + viewRect.height) {
617:                        g.drawLine(x, y, x, y + h - 2);
618:                    } else {
619:                        g.drawLine(x, selRect.y + selRect.height + 1, x, y + h
620:                                - 2);
621:                    }
622:                } else {
623:                    super .paintContentBorderLeftEdge(g, tabPlacement,
624:                            selectedIndex, x, y, w, h);
625:                }
626:            }
627:
628:            // paint the content right line when the tab is on the right
629:            @Override
630:            protected void paintContentBorderRightEdge(Graphics g,
631:                    int tabPlacement, int selectedIndex, int x, int y, int w,
632:                    int h) {
633:                if (!PAINT_CONTENT_BORDER_EDGE) {
634:                    return;
635:                }
636:
637:                if (getColorTheme() != JideTabbedPane.COLOR_THEME_OFFICE2003) {
638:                    super .paintContentBorderRightEdge(g, tabPlacement,
639:                            selectedIndex, x, y, w, h);
640:                    return;
641:                }
642:
643:                if (selectedIndex < 0) {
644:                    return;
645:                }
646:
647:                Rectangle selRect = getTabBounds(selectedIndex, _calcRect);
648:
649:                Rectangle viewRect = _tabScroller.viewport.getViewRect();
650:                Rectangle r = _rects[selectedIndex];
651:
652:                int tabShape = getTabShape();
653:
654:                Insets contentInsets = getContentBorderInsets(tabPlacement);
655:
656:                if (tabShape == JideTabbedPane.SHAPE_OFFICE2003) {
657:                    g.setColor(getPainter().getControlShadow());
658:
659:                    if (_alwaysShowLineBorder || _tabPane.hasFocusComponent()) {
660:                        if (contentInsets.top > 0) {
661:                            g.drawLine(x, y, x + w - 1, y);// top
662:                        }
663:                        if (contentInsets.left > 0) {
664:                            g.drawLine(x, y, x, y + h - 1);// left
665:                        }
666:                        if (contentInsets.bottom > 0) {
667:                            g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);// bottom
668:                        }
669:
670:                        if (contentInsets.right > 0) {
671:                            if (!_tabPane.isTabShown()
672:                                    || r.y >= viewRect.y + viewRect.height) {
673:                                g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);// right
674:                            } else {
675:                                g.drawLine(x + w - 1, y, x + w - 1, selRect.y
676:                                        - selRect.width + 2);// right top
677:                                g.drawLine(x + w - 1, selRect.y
678:                                        + selRect.height, x + w - 1, y + h - 1);// right bottom
679:                            }
680:                        }
681:                    } else if (_tabPane.isTabShown()) {
682:                        if (r.y >= viewRect.y + viewRect.height) {
683:                            g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);// right
684:                        } else {
685:                            g.drawLine(x + w - 1, y, x + w - 1, selRect.y
686:                                    - selRect.width + 2);// right top
687:                            g.drawLine(x + w - 1, selRect.y + selRect.height, x
688:                                    + w - 1, y + h - 1);// right bottom
689:                        }
690:                    }
691:                } else if (tabShape == JideTabbedPane.SHAPE_EXCEL) {
692:                    g.setColor(getPainter().getControlShadow());
693:
694:                    g.drawLine(x + w - 1, y, x + w - 1, selRect.y
695:                            - selRect.width / 2 + 4);// right top
696:
697:                    if (contentInsets.top > 0) {
698:                        g.drawLine(x, y, x + w - 1, y);// top
699:                    }
700:                    if (contentInsets.left > 0) {
701:                        g.drawLine(x, y, x, y + h - 1);// left
702:                    }
703:                    if (contentInsets.bottom > 0) {
704:                        g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);// bottom
705:                    }
706:
707:                    if (!_tabPane.isTabShown()
708:                            || r.y >= viewRect.y + viewRect.height) {
709:                        g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);// right
710:                    } else {
711:                        g.drawLine(x + w - 1, selRect.y + selRect.height
712:                                + selRect.width / 2 - 4, x + w - 1, y + h - 1);// right bottom
713:                    }
714:                } else if (tabShape == JideTabbedPane.SHAPE_WINDOWS
715:                        || tabShape == JideTabbedPane.SHAPE_WINDOWS_SELECTED) {
716:                    g.setColor(getPainter().getControlDk());
717:                    g.drawLine(x + w - 2, y + 1, x + w - 2, selRect.y - 2);
718:                    g.drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2);
719:
720:                    g.setColor(getPainter().getControlShadow());
721:                    g.drawLine(x + w - 1, y + 1, x + w - 1, selRect.y - 2);
722:                    if (contentInsets.bottom > 0) {
723:                        g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);// bottom
724:                    }
725:
726:                    if (!_tabPane.isTabShown()
727:                            || r.y >= viewRect.y + viewRect.height) {
728:                        g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
729:                        g.setColor(getPainter().getControlDk());
730:                        g.drawLine(x + w - 2, y + 1, x + w - 2, y + h - 2);
731:                    } else {
732:                        g.drawLine(x + w - 1, selRect.y + selRect.height + 1, x
733:                                + w - 1, y + h - 1);
734:                        g.setColor(getPainter().getControlDk());
735:                        g.drawLine(x + w - 2, selRect.y + selRect.height + 2, x
736:                                + w - 2, y + h - 2);
737:                        g.drawLine(x + w - 1, selRect.y + selRect.height, x + w
738:                                - 1, selRect.y + selRect.height);
739:                    }
740:
741:                    g.setColor(new Color(255, 255, 255));
742:                    if (contentInsets.top > 0) {
743:                        g.drawLine(x, y, x + w - 1, y);// top
744:                    }
745:                    if (contentInsets.left > 0) {
746:                        g.drawLine(x, y, x, y + h - 1);// left
747:                    }
748:                } else {
749:                    super.paintContentBorderRightEdge(g, tabPlacement,
750:                            selectedIndex, x, y, w, h);
751:                }
752:            }
753:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.