Source Code Cross Referenced for PaletteNewComponent.java in  » Report » FreeReportBuilder » it » frb » 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 » Report » FreeReportBuilder » it.frb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2004 Giuseppe MANNA
003:         * 
004:         * This file is part of FreeReportBuilder
005:         * 
006:         * FreeReportBuilder is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License
008:         * as published by the Free Software Foundation; either version 2
009:         * of the License, or (at your option) any later version.
010:         * 
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         * 
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019:         * 
020:         */
021:
022:        package it.frb;
023:
024:        import java.awt.Dimension;
025:        import java.awt.Point;
026:        import java.awt.event.MouseEvent;
027:        import javax.swing.ImageIcon;
028:        import javax.swing.JButton;
029:        import it.frb.action.*;
030:
031:        public class PaletteNewComponent extends javax.swing.JWindow implements 
032:                java.awt.event.ActionListener, java.awt.event.MouseListener,
033:                java.awt.event.MouseMotionListener {
034:            JButton jbColumn = null;
035:            JButton jbLabel = null;
036:            JButton jbVLine = null;
037:            JButton jbHLine = null;
038:            JButton jbNReport = null;
039:            JButton jbCField = null;
040:            JButton jbTextArea = null;
041:            JButton jbPicture = null;
042:            JButton jbCloseWindow = null;
043:            JButton jbDragWindow = null;
044:
045:            DataPanel dataPanel = null;
046:
047:            boolean press;
048:            Point click = new Point();
049:
050:            public PaletteNewComponent(DataPanel dataPanel) {
051:                //super(((javax.swing.JFrame)javax.swing.SwingUtilities.getRoot(dataPanel)));
052:                super ((java.awt.Frame) javax.swing.SwingUtilities
053:                        .windowForComponent(dataPanel));
054:
055:                this .dataPanel = dataPanel;
056:                java.awt.GridLayout gridLayout = new java.awt.GridLayout(8, 1);
057:
058:                javax.swing.JPanel newCompPanel = new javax.swing.JPanel(
059:                        gridLayout);
060:                newCompPanel.setBorder(javax.swing.BorderFactory
061:                        .createEtchedBorder());
062:
063:                java.net.URL imgIconURL = PaletteNewComponent.class
064:                        .getResource("img/column.png");
065:                jbColumn = new JButton(new ImageIcon(imgIconURL));
066:                jbColumn.setPreferredSize(new Dimension(40, 30));
067:                jbColumn.addActionListener(this );
068:                jbColumn.setToolTipText("Column");
069:
070:                imgIconURL = PaletteNewComponent.class
071:                        .getResource("img/label.png");
072:                jbLabel = new JButton(new ImageIcon(imgIconURL));
073:                jbLabel.setPreferredSize(new Dimension(40, 30));
074:                jbLabel.addActionListener(this );
075:                jbLabel.setToolTipText("Label");
076:
077:                imgIconURL = PaletteNewComponent.class
078:                        .getResource("img/vertline.png");
079:                jbVLine = new JButton(new ImageIcon(imgIconURL));
080:                jbVLine.setPreferredSize(new Dimension(40, 30));
081:                jbVLine.addActionListener(this );
082:                jbVLine.setToolTipText("Horizontal line");
083:
084:                imgIconURL = PaletteNewComponent.class
085:                        .getResource("img/horline.png");
086:                jbHLine = new JButton(new ImageIcon(imgIconURL));
087:                jbHLine.setPreferredSize(new Dimension(40, 30));
088:                jbHLine.addActionListener(this );
089:                jbHLine.setToolTipText("Vertical line");
090:
091:                imgIconURL = PaletteNewComponent.class
092:                        .getResource("img/nested.png");
093:                jbNReport = new JButton(new ImageIcon(imgIconURL));
094:                jbNReport.setPreferredSize(new Dimension(40, 30));
095:                jbNReport.addActionListener(this );
096:                jbNReport.setToolTipText("Nested report");
097:
098:                imgIconURL = PaletteNewComponent.class
099:                        .getResource("img/computed.png");
100:                jbCField = new JButton(new ImageIcon(imgIconURL));
101:                jbCField.setPreferredSize(new Dimension(40, 30));
102:                jbCField.addActionListener(this );
103:                jbCField.setToolTipText("Calculated field");
104:
105:                imgIconURL = PaletteNewComponent.class
106:                        .getResource("img/text.png");
107:                jbTextArea = new JButton(new ImageIcon(imgIconURL));
108:                jbTextArea.setPreferredSize(new Dimension(40, 30));
109:                jbTextArea.addActionListener(this );
110:                jbTextArea.setToolTipText("Text");
111:
112:                imgIconURL = PaletteNewComponent.class
113:                        .getResource("img/image.png");
114:                jbPicture = new JButton(new ImageIcon(imgIconURL));
115:                jbPicture.setPreferredSize(new Dimension(40, 30));
116:                jbPicture.addActionListener(this );
117:                jbPicture.setToolTipText("Image");
118:
119:                imgIconURL = PaletteNewComponent.class
120:                        .getResource("img/close.png");
121:                jbCloseWindow = new JButton(new ImageIcon(imgIconURL));
122:                jbCloseWindow.setPreferredSize(new Dimension(15, 11));
123:                jbCloseWindow.addActionListener(this );
124:
125:                imgIconURL = PaletteNewComponent.class
126:                        .getResource("img/drag.png");
127:                jbDragWindow = new JButton(new ImageIcon(imgIconURL));
128:                jbDragWindow.setPreferredSize(new Dimension(21, 11));
129:                jbDragWindow.addMouseMotionListener(this );
130:                jbDragWindow.addMouseListener(this );
131:
132:                newCompPanel.add(jbColumn);
133:                newCompPanel.add(jbLabel);
134:                newCompPanel.add(jbVLine);
135:                newCompPanel.add(jbHLine);
136:                newCompPanel.add(jbNReport);
137:                newCompPanel.add(jbCField);
138:                newCompPanel.add(jbTextArea);
139:                newCompPanel.add(jbPicture);
140:
141:                this .setBounds(0, 0, 40, 300);
142:                javax.swing.JToolBar jt = new javax.swing.JToolBar(
143:                        javax.swing.JToolBar.HORIZONTAL);
144:                jt
145:                        .setComponentOrientation(java.awt.ComponentOrientation.RIGHT_TO_LEFT);
146:                jt.add(jbCloseWindow);
147:                jt.add(jbDragWindow);
148:                jt.addMouseMotionListener(this );
149:                jt.addMouseListener(this );
150:                jt.setPreferredSize(new Dimension(200, 15));
151:                jt.setFloatable(false);
152:                jt.setBorder(javax.swing.BorderFactory.createEtchedBorder());
153:
154:                int x = dataPanel.getWidth();
155:                int y = dataPanel.getHeight();
156:
157:                this .setLocation(x - 200, y - 400);
158:
159:                this .getContentPane().add(jt, java.awt.BorderLayout.NORTH);
160:                this .getContentPane().add(newCompPanel,
161:                        java.awt.BorderLayout.CENTER);
162:                this .setVisible(true);
163:            }
164:
165:            public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
166:                if (actionEvent.getSource().equals(jbColumn)) {
167:                    ActionAddColumn action = new ActionAddColumn("AddColumn");
168:                    action.setDataPanel(dataPanel);
169:                    action.actionPerformed(actionEvent);
170:
171:                } else if (actionEvent.getSource().equals(jbLabel)) {
172:                    ActionAddLabel action = new ActionAddLabel("AddLabel");
173:                    action.setDataPanel(dataPanel);
174:                    action.actionPerformed(actionEvent);
175:
176:                } else if (actionEvent.getSource().equals(jbHLine)) {
177:                    ActionAddHorLine action = new ActionAddHorLine(
178:                            "AddHorizontalLine");
179:                    action.setDataPanel(dataPanel);
180:                    action.actionPerformed(actionEvent);
181:
182:                } else if (actionEvent.getSource().equals(jbVLine)) {
183:                    ActionAddVertLine action = new ActionAddVertLine(
184:                            "AddVerticalLine");
185:                    action.setDataPanel(dataPanel);
186:                    action.actionPerformed(actionEvent);
187:
188:                } else if (actionEvent.getSource().equals(jbCField)) {
189:                    ActionAddComputedField action = new ActionAddComputedField(
190:                            "AddCField");
191:                    action.setDataPanel(dataPanel);
192:                    action.actionPerformed(actionEvent);
193:
194:                } else if (actionEvent.getSource().equals(jbNReport)) {
195:                    ActionAddNestedReport action = new ActionAddNestedReport(
196:                            "AddNestedReport");
197:                    action.setDataPanel(dataPanel);
198:                    action.actionPerformed(actionEvent);
199:
200:                } else if (actionEvent.getSource().equals(jbTextArea)) {
201:                    ActionAddTextArea action = new ActionAddTextArea(
202:                            "AddTextArea");
203:                    action.setDataPanel(dataPanel);
204:                    action.actionPerformed(actionEvent);
205:
206:                } else if (actionEvent.getSource().equals(jbPicture)) {
207:                    ActionAddPicture action = new ActionAddPicture("AddPicture");
208:                    action.setDataPanel(dataPanel);
209:                    action.actionPerformed(actionEvent);
210:
211:                } else if (actionEvent.getSource().equals(jbCloseWindow)) {
212:                    this .dataPanel.setShowPalette(false);
213:                    this .dispose();
214:                    dataPanel.getTextArea().requestFocus();
215:                    javax.swing.SwingUtilities.getWindowAncestor(dataPanel)
216:                            .transferFocus();
217:                }
218:            }
219:
220:            public void mouseDragged(MouseEvent mouseEvent) {
221:                if (press) {
222:                    javax.swing.JComponent c = (javax.swing.JComponent) mouseEvent
223:                            .getSource();
224:
225:                    Point loc = c.getLocationOnScreen();
226:                    Point pt = new Point();
227:
228:                    pt.x = mouseEvent.getX() + loc.x - click.x;
229:                    pt.y = mouseEvent.getY() + loc.y - click.y;
230:
231:                    this .setLocation(this .getLocation().x + pt.x - loc.x, this 
232:                            .getLocation().y
233:                            + pt.y - loc.y);
234:                }
235:            }
236:
237:            public void mousePressed(MouseEvent mouseEvent) {
238:                click.x = mouseEvent.getX();
239:                click.y = mouseEvent.getY();
240:
241:                press = true;
242:            }
243:
244:            public void mouseReleased(MouseEvent mouseEvent) {
245:                press = false;
246:            }
247:
248:            public void mouseMoved(MouseEvent mouseEvent) {
249:            }
250:
251:            public void mouseClicked(MouseEvent mouseEvent) {
252:            }
253:
254:            public void mouseEntered(MouseEvent mouseEvent) {
255:            }
256:
257:            public void mouseExited(MouseEvent mouseEvent) {
258:            }
259:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.