Source Code Cross Referenced for JGraphpadShadowBorder.java in  » Graphic-Library » jgraphpad » com » jgraph » pad » util » 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 » Graphic Library » jgraphpad » com.jgraph.pad.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * $Id: JGraphpadShadowBorder.java,v 1.1.1.1 2005/08/04 11:21:58 gaudenz Exp $
03:         * Copyright (c) 2001-2005, Gaudenz Alder
04:         * 
05:         * All rights reserved. 
06:         * 
07:         * This file is licensed under the JGraph software license, a copy of which
08:         * will have been provided to you in the file LICENSE at the root of your
09:         * installation directory. If you are unable to locate this file please
10:         * contact JGraph sales for another copy.
11:         */
12:        package com.jgraph.pad.util;
13:
14:        import java.awt.Color;
15:        import java.awt.Component;
16:        import java.awt.Graphics;
17:        import java.awt.Insets;
18:        import java.io.Serializable;
19:
20:        import javax.swing.border.Border;
21:
22:        /**
23:         * Border with a drop shadow.
24:         */
25:        public class JGraphpadShadowBorder implements  Border, Serializable {
26:            private Insets insets;
27:
28:            public static JGraphpadShadowBorder sharedInstance = new JGraphpadShadowBorder();
29:
30:            private JGraphpadShadowBorder() {
31:                insets = new Insets(1, 1, 3, 3);
32:            }
33:
34:            public Insets getBorderInsets(Component c) {
35:                return insets;
36:            }
37:
38:            public boolean isBorderOpaque() {
39:                // we'll be filling in our own background.
40:                return true;
41:            }
42:
43:            public void paintBorder(Component c, Graphics g, int x, int y,
44:                    int w, int h) {
45:                // choose which colors we want to use
46:                Color bg = c.getBackground();
47:                if (c.getParent() != null)
48:                    bg = c.getParent().getBackground();
49:                Color mid = bg.darker();
50:                Color rect = mid.darker();
51:                Color edge = average(mid, bg);
52:
53:                // fill in the corners with the parent-background
54:                // so it looks see-through
55:                g.setColor(bg);
56:                g.fillRect(0, h - 3, 3, 3);
57:                g.fillRect(w - 3, 0, 3, 3);
58:                g.fillRect(w - 3, h - 3, 3, 3);
59:
60:                // draw the outline
61:                g.setColor(rect);
62:                g.drawRect(0, 0, w - 3, h - 3);
63:
64:                // draw the drop-shadow
65:                g.setColor(mid);
66:                g.drawLine(1, h - 2, w - 2, h - 2);
67:                g.drawLine(w - 2, 1, w - 2, h - 2);
68:
69:                g.setColor(edge);
70:                g.drawLine(2, h - 1, w - 2, h - 1);
71:                g.drawLine(w - 1, 2, w - 1, h - 2);
72:            }
73:
74:            private static Color average(Color c1, Color c2) {
75:                int red = c1.getRed() + (c2.getRed() - c1.getRed()) / 2;
76:                int green = c1.getGreen() + (c2.getGreen() - c1.getGreen()) / 2;
77:                int blue = c1.getBlue() + (c2.getBlue() - c1.getBlue()) / 2;
78:                return new Color(red, green, blue);
79:            }
80:
81:            public static JGraphpadShadowBorder getSharedInstance() {
82:                return sharedInstance;
83:            }
84:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.