Source Code Cross Referenced for ClassPathDialog.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » gui » 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 » iReport 2.0.5 » it.businesslogic.ireport.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2005 - 2008 JasperSoft Corporation.  All rights reserved. 
003:         * http://www.jaspersoft.com.
004:         *
005:         * Unless you have purchased a commercial license agreement from JasperSoft,
006:         * the following license terms apply:
007:         *
008:         * This program is free software; you can redistribute it and/or modify
009:         * it under the terms of the GNU General Public License version 2 as published by
010:         * the Free Software Foundation.
011:         *
012:         * This program is distributed WITHOUT ANY WARRANTY; and without the
013:         * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014:         * See the 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, see http://www.gnu.org/licenses/gpl.txt
018:         * or write to:
019:         *
020:         * Free Software Foundation, Inc.,
021:         * 59 Temple Place - Suite 330,
022:         * Boston, MA  USA  02111-1307
023:         *
024:         *
025:         *
026:         *
027:         * ClassPathDialog.java
028:         * 
029:         * Created on 22 aprile 2005, 18.05
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui;
034:
035:        import javax.swing.DefaultListModel;
036:        import java.util.*;
037:        import it.businesslogic.ireport.util.I18n;
038:
039:        /**
040:         *
041:         * @author  Administrator
042:         */
043:        public class ClassPathDialog extends javax.swing.JDialog {
044:
045:            private int dialogResult = javax.swing.JOptionPane.CANCEL_OPTION;
046:            private boolean modifiedPath = false;
047:
048:            /** Creates new form ClassPathDialog */
049:            public ClassPathDialog(java.awt.Frame parent, boolean modal) {
050:                super (parent, modal);
051:                initComponents();
052:
053:                jList1.setModel(new DefaultListModel());
054:                it.businesslogic.ireport.util.Misc.centerFrame(this );
055:
056:                javax.swing.KeyStroke escape = javax.swing.KeyStroke
057:                        .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
058:                                false);
059:                javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
060:                    public void actionPerformed(java.awt.event.ActionEvent e) {
061:                        jButtonCancelActionPerformed(e);
062:                    }
063:                };
064:
065:                getRootPane().getInputMap(
066:                        javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
067:                        escape, "ESCAPE");
068:                getRootPane().getActionMap().put("ESCAPE", escapeAction);
069:
070:                applyI18n();
071:
072:                //to make the default button ...
073:                this .getRootPane().setDefaultButton(this .jButtonSave);
074:            }
075:
076:            /** This method is called from within the constructor to
077:             * initialize the form.
078:             * WARNING: Do NOT modify this code. The content of this method is
079:             * always regenerated by the Form Editor.
080:             */
081:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
082:            private void initComponents() {
083:                java.awt.GridBagConstraints gridBagConstraints;
084:
085:                jLabelClasspath = new javax.swing.JLabel();
086:                jScrollPane1 = new javax.swing.JScrollPane();
087:                jList1 = new javax.swing.JList();
088:                jPanel1 = new javax.swing.JPanel();
089:                jButtonAdd = new javax.swing.JButton();
090:                jButtonAdd1 = new javax.swing.JButton();
091:                jButtonRemove = new javax.swing.JButton();
092:                jButtonMoveUp = new javax.swing.JButton();
093:                jButtonMoveDown = new javax.swing.JButton();
094:                jPanel2 = new javax.swing.JPanel();
095:                jButtonSave = new javax.swing.JButton();
096:                jButtonCancel = new javax.swing.JButton();
097:
098:                getContentPane().setLayout(new java.awt.GridBagLayout());
099:
100:                setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
101:                setTitle("Classpath");
102:                setTitle(it.businesslogic.ireport.util.I18n.getString(
103:                        "classPath", "Classpath"));//I18N
104:                addWindowListener(new java.awt.event.WindowAdapter() {
105:                    public void windowClosed(java.awt.event.WindowEvent evt) {
106:                        formWindowClosed(evt);
107:                    }
108:
109:                    public void windowClosing(java.awt.event.WindowEvent evt) {
110:                        formWindowClosing(evt);
111:                    }
112:                });
113:
114:                jLabelClasspath
115:                        .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
116:                jLabelClasspath.setText("Classpath");
117:                jLabelClasspath.setText(it.businesslogic.ireport.util.I18n
118:                        .getString("classPath", "Classpath"));//I18N
119:                gridBagConstraints = new java.awt.GridBagConstraints();
120:                gridBagConstraints.gridx = 0;
121:                gridBagConstraints.gridy = 0;
122:                gridBagConstraints.gridwidth = 2;
123:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
124:                gridBagConstraints.ipadx = 1;
125:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
126:                getContentPane().add(jLabelClasspath, gridBagConstraints);
127:
128:                jScrollPane1.setPreferredSize(new java.awt.Dimension(359, 260));
129:                jScrollPane1.setViewportView(jList1);
130:
131:                gridBagConstraints = new java.awt.GridBagConstraints();
132:                gridBagConstraints.gridx = 0;
133:                gridBagConstraints.gridy = 1;
134:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
135:                gridBagConstraints.weightx = 1.0;
136:                gridBagConstraints.weighty = 1.0;
137:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 4);
138:                getContentPane().add(jScrollPane1, gridBagConstraints);
139:
140:                jPanel1.setLayout(new java.awt.GridBagLayout());
141:
142:                jPanel1.setMinimumSize(new java.awt.Dimension(120, 10));
143:                jPanel1.setPreferredSize(new java.awt.Dimension(120, 10));
144:                jButtonAdd.setText("Add JAR");
145:                jButtonAdd.setText(it.businesslogic.ireport.util.I18n
146:                        .getString("addJAR", "Add JAR"));//I18N
147:                jButtonAdd.setMaximumSize(new java.awt.Dimension(200, 26));
148:                jButtonAdd.setMinimumSize(new java.awt.Dimension(90, 26));
149:                jButtonAdd.setPreferredSize(new java.awt.Dimension(120, 26));
150:                jButtonAdd
151:                        .addActionListener(new java.awt.event.ActionListener() {
152:                            public void actionPerformed(
153:                                    java.awt.event.ActionEvent evt) {
154:                                jButtonAddActionPerformed(evt);
155:                            }
156:                        });
157:
158:                gridBagConstraints = new java.awt.GridBagConstraints();
159:                gridBagConstraints.gridx = 0;
160:                gridBagConstraints.gridy = 0;
161:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
162:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
163:                jPanel1.add(jButtonAdd, gridBagConstraints);
164:
165:                jButtonAdd1.setText("Add Folder");
166:                jButtonAdd1.setText(it.businesslogic.ireport.util.I18n
167:                        .getString("addFolder", "Add Folder"));//I18N
168:                jButtonAdd1.setMaximumSize(new java.awt.Dimension(200, 26));
169:                jButtonAdd1.setMinimumSize(new java.awt.Dimension(90, 26));
170:                jButtonAdd1.setPreferredSize(new java.awt.Dimension(120, 26));
171:                jButtonAdd1.setToolTipText(it.businesslogic.ireport.util.I18n
172:                        .getString("addFolder", "Add Folder"));//I18N
173:                jButtonAdd1
174:                        .addActionListener(new java.awt.event.ActionListener() {
175:                            public void actionPerformed(
176:                                    java.awt.event.ActionEvent evt) {
177:                                jButtonAddActionPerformed1(evt);
178:                            }
179:                        });
180:
181:                gridBagConstraints = new java.awt.GridBagConstraints();
182:                gridBagConstraints.gridx = 0;
183:                gridBagConstraints.gridy = 1;
184:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
185:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
186:                jPanel1.add(jButtonAdd1, gridBagConstraints);
187:
188:                jButtonRemove.setText("Remove");
189:                jButtonRemove.setText(it.businesslogic.ireport.util.I18n
190:                        .getString("remove", "Remove"));//I18N
191:                jButtonRemove.setMaximumSize(new java.awt.Dimension(200, 26));
192:                jButtonRemove.setMinimumSize(new java.awt.Dimension(90, 26));
193:                jButtonRemove.setPreferredSize(new java.awt.Dimension(120, 26));
194:                jButtonRemove
195:                        .addActionListener(new java.awt.event.ActionListener() {
196:                            public void actionPerformed(
197:                                    java.awt.event.ActionEvent evt) {
198:                                jButtonRemoveActionPerformed(evt);
199:                            }
200:                        });
201:
202:                gridBagConstraints = new java.awt.GridBagConstraints();
203:                gridBagConstraints.gridx = 0;
204:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
205:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
206:                jPanel1.add(jButtonRemove, gridBagConstraints);
207:
208:                jButtonMoveUp.setText("Move up");
209:                jButtonMoveUp.setText(it.businesslogic.ireport.util.I18n
210:                        .getString("moveUp", "Move up"));//I18N
211:                jButtonMoveUp.setMaximumSize(new java.awt.Dimension(200, 26));
212:                jButtonMoveUp.setMinimumSize(new java.awt.Dimension(90, 26));
213:                jButtonMoveUp.setPreferredSize(new java.awt.Dimension(120, 26));
214:                jButtonMoveUp
215:                        .addActionListener(new java.awt.event.ActionListener() {
216:                            public void actionPerformed(
217:                                    java.awt.event.ActionEvent evt) {
218:                                jButtonMoveUpActionPerformed(evt);
219:                            }
220:                        });
221:
222:                gridBagConstraints = new java.awt.GridBagConstraints();
223:                gridBagConstraints.gridx = 0;
224:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
225:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
226:                jPanel1.add(jButtonMoveUp, gridBagConstraints);
227:
228:                jButtonMoveDown.setText("Move down");
229:                jButtonMoveDown.setText(it.businesslogic.ireport.util.I18n
230:                        .getString("moveDown", "Move down"));//I18N
231:                jButtonMoveDown.setMaximumSize(new java.awt.Dimension(200, 26));
232:                jButtonMoveDown.setMinimumSize(new java.awt.Dimension(90, 26));
233:                jButtonMoveDown
234:                        .setPreferredSize(new java.awt.Dimension(120, 26));
235:                jButtonMoveDown
236:                        .addActionListener(new java.awt.event.ActionListener() {
237:                            public void actionPerformed(
238:                                    java.awt.event.ActionEvent evt) {
239:                                jButtonMoveDownActionPerformed(evt);
240:                            }
241:                        });
242:
243:                gridBagConstraints = new java.awt.GridBagConstraints();
244:                gridBagConstraints.gridx = 0;
245:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
246:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
247:                jPanel1.add(jButtonMoveDown, gridBagConstraints);
248:
249:                gridBagConstraints = new java.awt.GridBagConstraints();
250:                gridBagConstraints.gridx = 0;
251:                gridBagConstraints.weighty = 1.0;
252:                jPanel1.add(jPanel2, gridBagConstraints);
253:
254:                jButtonSave.setText("Save classpath");
255:                jButtonSave.setText(it.businesslogic.ireport.util.I18n
256:                        .getString("saveClasspath", "Save classpath"));//I18N
257:                jButtonSave.setMaximumSize(new java.awt.Dimension(200, 26));
258:                jButtonSave.setMinimumSize(new java.awt.Dimension(90, 26));
259:                jButtonSave.setPreferredSize(new java.awt.Dimension(120, 26));
260:                jButtonSave.setToolTipText(it.businesslogic.ireport.util.I18n
261:                        .getString("saveClasspath", "Save classpath"));//I18N
262:                jButtonSave
263:                        .addActionListener(new java.awt.event.ActionListener() {
264:                            public void actionPerformed(
265:                                    java.awt.event.ActionEvent evt) {
266:                                jButtonSaveActionPerformed(evt);
267:                            }
268:                        });
269:
270:                gridBagConstraints = new java.awt.GridBagConstraints();
271:                gridBagConstraints.gridx = 0;
272:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
273:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
274:                jPanel1.add(jButtonSave, gridBagConstraints);
275:
276:                jButtonCancel.setText("Cancel");
277:                jButtonCancel.setText(it.businesslogic.ireport.util.I18n
278:                        .getString("cancel", "Cancel"));//I18N
279:                jButtonCancel.setMaximumSize(new java.awt.Dimension(200, 26));
280:                jButtonCancel.setMinimumSize(new java.awt.Dimension(90, 26));
281:                jButtonCancel.setPreferredSize(new java.awt.Dimension(120, 26));
282:                jButtonCancel
283:                        .addActionListener(new java.awt.event.ActionListener() {
284:                            public void actionPerformed(
285:                                    java.awt.event.ActionEvent evt) {
286:                                jButtonCancelActionPerformed(evt);
287:                            }
288:                        });
289:
290:                gridBagConstraints = new java.awt.GridBagConstraints();
291:                gridBagConstraints.gridx = 0;
292:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
293:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
294:                jPanel1.add(jButtonCancel, gridBagConstraints);
295:
296:                gridBagConstraints = new java.awt.GridBagConstraints();
297:                gridBagConstraints.gridx = 1;
298:                gridBagConstraints.gridy = 1;
299:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
300:                gridBagConstraints.weighty = 1.0;
301:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 4);
302:                getContentPane().add(jPanel1, gridBagConstraints);
303:
304:                pack();
305:            }// </editor-fold>//GEN-END:initComponents
306:
307:            private void jButtonAddActionPerformed1(
308:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddActionPerformed1
309:                String fileName = "";
310:                javax.swing.JFileChooser jfc = new javax.swing.JFileChooser(
311:                        MainFrame.getMainInstance().getCurrentDirectory());
312:
313:                jfc.setDialogTitle("Add JAR(s) / path to the classpath");
314:                jfc.setDialogTitle(it.businesslogic.ireport.util.I18n
315:                        .getString("addToClassPath",
316:                                "Add JAR(s) / path to the classpath"));//I18N
317:
318:                jfc.setAcceptAllFileFilterUsed(true);
319:                jfc.setFileSelectionMode(jfc.DIRECTORIES_ONLY);
320:                /*jfc.addChoosableFileFilter( new javax.swing.filechooser.FileFilter() {
321:                    public boolean accept(java.io.File file) {
322:                        String filename = file.getName();
323:                        return (filename.toLowerCase().endsWith(".jar") || file.isDirectory() ||
324:                                filename.toLowerCase().endsWith(".zip")
325:                                ) ;
326:                    }
327:                    public String getDescription() {
328:                        return "*.jar, *.zip";
329:                    }
330:                });
331:                 */
332:
333:                jfc.setMultiSelectionEnabled(true);
334:
335:                jfc.setDialogType(javax.swing.JFileChooser.OPEN_DIALOG);
336:                if (jfc.showOpenDialog(this ) == javax.swing.JOptionPane.OK_OPTION) {
337:                    java.io.File[] files = jfc.getSelectedFiles();
338:
339:                    for (int i = 0; i < files.length; ++i) {
340:                        ((DefaultListModel) jList1.getModel())
341:                                .addElement(files[i]);
342:                    }
343:                    MainFrame.getMainInstance().setCurrentDirectory(
344:                            jfc.getSelectedFile(), true);
345:                    modifiedPath = true;
346:                }
347:            }//GEN-LAST:event_jButtonAddActionPerformed1
348:
349:            private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
350:
351:            }//GEN-LAST:event_formWindowClosed
352:
353:            private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
354:
355:                if (modifiedPath) {
356:                    int ret = javax.swing.JOptionPane.showConfirmDialog(this ,
357:                            I18n.getString("message.classpath.save",
358:                                    "Do you want save the classpath ?"));
359:
360:                    if (ret == javax.swing.JOptionPane.CANCEL_OPTION) {
361:                        return;
362:                    }
363:
364:                    if (ret == javax.swing.JOptionPane.OK_OPTION) {
365:                        setDialogResult(javax.swing.JOptionPane.OK_OPTION);
366:                    }
367:                }
368:                setVisible(false);
369:            }//GEN-LAST:event_formWindowClosing
370:
371:            private void jButtonCancelActionPerformed(
372:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed
373:                setVisible(false);
374:            }//GEN-LAST:event_jButtonCancelActionPerformed
375:
376:            private void jButtonSaveActionPerformed(
377:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveActionPerformed
378:                setDialogResult(javax.swing.JOptionPane.OK_OPTION);
379:                setVisible(false);
380:            }//GEN-LAST:event_jButtonSaveActionPerformed
381:
382:            private void jButtonMoveUpActionPerformed(
383:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMoveUpActionPerformed
384:
385:                if (jList1.getSelectedValues() != null) {
386:                    int[] indices = jList1.getSelectedIndices();
387:                    for (int i = 0; i < indices.length; ++i) {
388:                        if (indices[i] == 0)
389:                            continue;
390:                        Object val = ((DefaultListModel) jList1.getModel())
391:                                .remove(indices[i]);
392:                        ((DefaultListModel) jList1.getModel()).insertElementAt(
393:                                val, indices[i] - 1);
394:                        indices[i]--;
395:                    }
396:                    jList1.setSelectedIndices(indices);
397:                    modifiedPath = true;
398:                }
399:
400:            }//GEN-LAST:event_jButtonMoveUpActionPerformed
401:
402:            private void jButtonMoveDownActionPerformed(
403:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMoveDownActionPerformed
404:                if (jList1.getSelectedValues() != null) {
405:                    int[] indices = jList1.getSelectedIndices();
406:                    for (int i = indices.length - 1; i >= 0; --i) {
407:                        if (indices[i] >= ((DefaultListModel) jList1.getModel())
408:                                .size() - 1)
409:                            continue;
410:
411:                        Object val = ((DefaultListModel) jList1.getModel())
412:                                .remove(indices[i]);
413:                        ((DefaultListModel) jList1.getModel()).insertElementAt(
414:                                val, indices[i] + 1);
415:                        indices[i]++;
416:                    }
417:                    jList1.setSelectedIndices(indices);
418:                    modifiedPath = true;
419:                }
420:            }//GEN-LAST:event_jButtonMoveDownActionPerformed
421:
422:            private void jButtonRemoveActionPerformed(
423:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemoveActionPerformed
424:
425:                if (jList1.getSelectedValues() != null) {
426:                    Object[] values = jList1.getSelectedValues();
427:                    for (int i = 0; i < values.length; ++i) {
428:                        ((DefaultListModel) jList1.getModel())
429:                                .removeElement(values[i]);
430:                    }
431:                    modifiedPath = true;
432:                }
433:
434:            }//GEN-LAST:event_jButtonRemoveActionPerformed
435:
436:            private void jButtonAddActionPerformed(
437:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddActionPerformed
438:
439:                String fileName = "";
440:                javax.swing.JFileChooser jfc = new javax.swing.JFileChooser(
441:                        MainFrame.getMainInstance().getCurrentDirectory());
442:
443:                jfc.setDialogTitle("Add JAR(s) / path to the classpath");
444:                jfc.setDialogTitle(it.businesslogic.ireport.util.I18n
445:                        .getString("addToClassPath",
446:                                "Add JAR(s) / path to the classpath"));//I18N
447:
448:                jfc.setAcceptAllFileFilterUsed(true);
449:                jfc.setFileSelectionMode(jfc.FILES_ONLY);
450:                jfc
451:                        .addChoosableFileFilter(new javax.swing.filechooser.FileFilter() {
452:                            public boolean accept(java.io.File file) {
453:                                String filename = file.getName();
454:                                return (filename.toLowerCase().endsWith(".jar")
455:                                        || file.isDirectory() || filename
456:                                        .toLowerCase().endsWith(".zip"));
457:                            }
458:
459:                            public String getDescription() {
460:                                return "*.jar, *.zip";
461:                            }
462:                        });
463:
464:                jfc.setMultiSelectionEnabled(true);
465:
466:                jfc.setDialogType(javax.swing.JFileChooser.OPEN_DIALOG);
467:                if (jfc.showOpenDialog(this ) == javax.swing.JOptionPane.OK_OPTION) {
468:                    java.io.File[] files = jfc.getSelectedFiles();
469:
470:                    for (int i = 0; i < files.length; ++i) {
471:                        ((DefaultListModel) jList1.getModel())
472:                                .addElement(files[i]);
473:                    }
474:                    MainFrame.getMainInstance().setCurrentDirectory(
475:                            jfc.getSelectedFile(), true);
476:                    modifiedPath = true;
477:                }
478:
479:            }//GEN-LAST:event_jButtonAddActionPerformed
480:
481:            /**
482:             * @param args the command line arguments
483:             */
484:            public static void main(String args[]) {
485:                java.awt.EventQueue.invokeLater(new Runnable() {
486:                    public void run() {
487:                        new ClassPathDialog(new javax.swing.JFrame(), true)
488:                                .setVisible(true);
489:                    }
490:                });
491:            }
492:
493:            public void setClasspath(Vector cp) {
494:                for (int i = 0; i < cp.size(); ++i) {
495:                    ((DefaultListModel) jList1.getModel()).addElement(cp
496:                            .elementAt(i));
497:                }
498:
499:            }
500:
501:            public Vector getClasspath() {
502:                Vector cp = new Vector();
503:                for (int i = 0; i < ((DefaultListModel) jList1.getModel())
504:                        .size(); ++i) {
505:                    cp.addElement(""
506:                            + ((DefaultListModel) jList1.getModel())
507:                                    .elementAt(i));
508:                }
509:
510:                return cp;
511:            }
512:
513:            public int getDialogResult() {
514:                return dialogResult;
515:            }
516:
517:            public void setDialogResult(int dialogResult) {
518:                this .dialogResult = dialogResult;
519:            }
520:
521:            // Variables declaration - do not modify//GEN-BEGIN:variables
522:            private javax.swing.JButton jButtonAdd;
523:            private javax.swing.JButton jButtonAdd1;
524:            private javax.swing.JButton jButtonCancel;
525:            private javax.swing.JButton jButtonMoveDown;
526:            private javax.swing.JButton jButtonMoveUp;
527:            private javax.swing.JButton jButtonRemove;
528:            private javax.swing.JButton jButtonSave;
529:            private javax.swing.JLabel jLabelClasspath;
530:            private javax.swing.JList jList1;
531:            private javax.swing.JPanel jPanel1;
532:            private javax.swing.JPanel jPanel2;
533:            private javax.swing.JScrollPane jScrollPane1;
534:
535:            // End of variables declaration//GEN-END:variables
536:
537:            public void applyI18n() {
538:
539:                this .setTitle(I18n.getString("classPathDialog.title",
540:                        "Classpath"));
541:                jButtonCancel.setMnemonic(I18n.getString(
542:                        "classPathDialog.buttonCancelMnemonic", "c").charAt(0));
543:                jButtonSave.setMnemonic(I18n.getString(
544:                        "classPathDialog.buttonSaveMnemonic", "s").charAt(0));
545:            }
546:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.