Source Code Cross Referenced for FieldPatternDialog.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) 


0001:        /*
0002:         * Copyright (C) 2005 - 2008 JasperSoft Corporation.  All rights reserved. 
0003:         * http://www.jaspersoft.com.
0004:         *
0005:         * Unless you have purchased a commercial license agreement from JasperSoft,
0006:         * the following license terms apply:
0007:         *
0008:         * This program is free software; you can redistribute it and/or modify
0009:         * it under the terms of the GNU General Public License version 2 as published by
0010:         * the Free Software Foundation.
0011:         *
0012:         * This program is distributed WITHOUT ANY WARRANTY; and without the
0013:         * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0014:         * See the GNU General Public License for more details.
0015:         *
0016:         * You should have received a copy of the GNU General Public License
0017:         * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
0018:         * or write to:
0019:         *
0020:         * Free Software Foundation, Inc.,
0021:         * 59 Temple Place - Suite 330,
0022:         * Boston, MA  USA  02111-1307
0023:         *
0024:         *
0025:         *
0026:         *
0027:         * FieldPatternDialog.java
0028:         * 
0029:         * Created on 10 luglio 2004, 0.50
0030:         *
0031:         */
0032:
0033:        package it.businesslogic.ireport.gui;
0034:
0035:        import it.businesslogic.ireport.util.I18n;
0036:
0037:        /**
0038:         *
0039:         * @author  Administrator
0040:         */
0041:        public class FieldPatternDialog extends javax.swing.JDialog {
0042:
0043:            private String pattern = "";
0044:            private int dialogResult = javax.swing.JOptionPane.CANCEL_OPTION;
0045:            private int selectedCategory = -1;
0046:            private static String[] dateFormats = new String[] { "dd/MM/yyyy",
0047:                    "MM/dd/yyyy", "yyyy/MM/dd", "EEEEE dd MMMMM yyyy",
0048:                    "MMMMM dd, yyyy", "dd/MM", "dd/MM/yy", "dd-MMM",
0049:                    "dd-MMM-yy", "MMM-yy", "MMMMM-yy", "dd MMMMM yyyy",
0050:                    "dd/MM/yyyy h.mm a", "dd/MM/yyyy HH.mm.ss", "MMM",
0051:                    "d/M/yyyy", "dd-MMM-yyyy", "yyyy.MM.dd G 'at' HH:mm:ss z",
0052:                    "EEE, MMM d, ''yy", "yyyy.MMMMM.dd GGG hh:mm aaa",
0053:                    "EEE, d MMM yyyy HH:mm:ss Z", "yyMMddHHmmssZ" };
0054:
0055:            private static String[] timeFormats = new String[] { "HH.mm",
0056:                    "h.mm a", "HH.mm.ss", "h.mm.ss a", "mm.ss,S",
0057:                    "hh 'o''clock' a, zzzz", "K:mm a, z",
0058:                    "yyyy.MMMMM.dd GGG hh:mm aaa",
0059:                    "yyyy.MM.dd G 'at' HH:mm:ss z",
0060:                    "EEE, d MMM yyyy HH:mm:ss Z", "yyMMddHHmmssZ" };
0061:
0062:            /** Creates new form FieldPatternDialog */
0063:            public FieldPatternDialog(java.awt.Frame parent, boolean modal) {
0064:                super (parent, modal);
0065:                initAll();
0066:            }
0067:
0068:            public FieldPatternDialog(java.awt.Dialog parent, boolean modal) {
0069:                super (parent, modal);
0070:                initAll();
0071:            }
0072:
0073:            public void initAll() {
0074:                initComponents();
0075:                applyI18n();
0076:                this .setSize(520, 350);
0077:                it.businesslogic.ireport.util.Misc.centerFrame(this );
0078:
0079:                javax.swing.DefaultListModel dlm = new javax.swing.DefaultListModel();
0080:                javax.swing.DefaultListModel dlm2 = new javax.swing.DefaultListModel();
0081:                javax.swing.DefaultListModel dlm3 = new javax.swing.DefaultListModel();
0082:                javax.swing.DefaultListModel dlm4 = new javax.swing.DefaultListModel();
0083:
0084:                jListCategory.setModel(dlm);
0085:                dlm.addElement("Number"); // 0
0086:                dlm.addElement("Date"); // 1
0087:                dlm.addElement("Time"); // 2
0088:                dlm.addElement("Currency"); // 3
0089:                dlm.addElement("Percentage"); // 4
0090:                dlm.addElement("Scientific"); // 5
0091:                //dlm.addElement( "Custom" );      // 7
0092:
0093:                jListNegatives.setModel(dlm2);
0094:                jListDateTypes.setModel(dlm3);
0095:                jListTimeTypes.setModel(dlm4);
0096:
0097:                javax.swing.SpinnerNumberModel sm = new javax.swing.SpinnerNumberModel(
0098:                        2, 0, 100, 1);
0099:                jSpinnerNumberDecimals.setModel(sm);
0100:                jSpinnerNumberDecimals1.setModel(sm);
0101:                jSpinnerNumberDecimals2.setModel(sm);
0102:                jSpinnerNumberDecimals3.setModel(sm);
0103:
0104:                jPanelSheets.removeAll();
0105:                ((javax.swing.DefaultComboBoxModel) jComboBoxPercentage
0106:                        .getModel()).addElement("%");
0107:                ((javax.swing.DefaultComboBoxModel) jComboBoxPercentage
0108:                        .getModel()).addElement("\u2030");
0109:
0110:                jPanelSheets.updateUI();
0111:                this .jListCategory.setSelectedIndex(0);
0112:                updateListNegatives();
0113:                updateListDateTypes();
0114:                updateListTimeTypes();
0115:
0116:                javax.swing.KeyStroke escape = javax.swing.KeyStroke
0117:                        .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
0118:                                false);
0119:                javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
0120:                    public void actionPerformed(java.awt.event.ActionEvent e) {
0121:                        jButton2ActionPerformed(e);
0122:                    }
0123:                };
0124:
0125:                getRootPane().getInputMap(
0126:                        javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
0127:                        escape, "ESCAPE");
0128:                getRootPane().getActionMap().put("ESCAPE", escapeAction);
0129:
0130:                //to make the default button ...
0131:                this .getRootPane().setDefaultButton(this .jButton1);
0132:
0133:            }
0134:
0135:            public void setOnlyDate(boolean b) {
0136:                if (b == true) {
0137:                    javax.swing.DefaultListModel dlm = (javax.swing.DefaultListModel) jListCategory
0138:                            .getModel();
0139:                    dlm.removeAllElements();
0140:                    dlm.addElement("Date");
0141:                    dlm.addElement("Time"); // 2
0142:                    selectedCategory = -1;
0143:                    jListCategory.setSelectedIndex(0);
0144:                    //jListCategoryValueChanged(null);
0145:                }
0146:            }
0147:
0148:            public void setOnlyNumbers(boolean b) {
0149:                if (b == true) {
0150:                    javax.swing.DefaultListModel dlm = (javax.swing.DefaultListModel) jListCategory
0151:                            .getModel();
0152:                    dlm.removeAllElements();
0153:                    dlm.addElement("Number"); // 0
0154:                    dlm.addElement("Scientific"); // 5
0155:                    selectedCategory = -1;
0156:                    jListCategory.setSelectedIndex(0);
0157:                    //jListCategoryValueChanged(null);
0158:                }
0159:            }
0160:
0161:            /** This method is called from within the constructor to
0162:             * initialize the form.
0163:             * WARNING: Do NOT modify this code. The content of this method is
0164:             * always regenerated by the Form Editor.
0165:             */
0166:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
0167:            private void initComponents() {
0168:                java.awt.GridBagConstraints gridBagConstraints;
0169:
0170:                jPanel1 = new javax.swing.JPanel();
0171:                jLabel1 = new javax.swing.JLabel();
0172:                jScrollPane1 = new javax.swing.JScrollPane();
0173:                jListCategory = new javax.swing.JList();
0174:                jPanel2 = new javax.swing.JPanel();
0175:                jPanelSheets = new javax.swing.JPanel();
0176:                jPanelNumber = new javax.swing.JPanel();
0177:                jLabel2 = new javax.swing.JLabel();
0178:                jSpinnerNumberDecimals = new javax.swing.JSpinner();
0179:                jLabel3 = new javax.swing.JLabel();
0180:                jCheckBox1 = new javax.swing.JCheckBox();
0181:                jLabel4 = new javax.swing.JLabel();
0182:                jPanel7 = new javax.swing.JPanel();
0183:                jScrollPane2 = new javax.swing.JScrollPane();
0184:                jListNegatives = new javax.swing.JList();
0185:                jPanelDate = new javax.swing.JPanel();
0186:                jLabel7 = new javax.swing.JLabel();
0187:                jScrollPane3 = new javax.swing.JScrollPane();
0188:                jListDateTypes = new javax.swing.JList();
0189:                jPanelTime = new javax.swing.JPanel();
0190:                jLabel8 = new javax.swing.JLabel();
0191:                jScrollPane4 = new javax.swing.JScrollPane();
0192:                jListTimeTypes = new javax.swing.JList();
0193:                jPanelCurrency = new javax.swing.JPanel();
0194:                jLabel5 = new javax.swing.JLabel();
0195:                jSpinnerNumberDecimals1 = new javax.swing.JSpinner();
0196:                jPanel9 = new javax.swing.JPanel();
0197:                jPanelPercentage = new javax.swing.JPanel();
0198:                jLabel6 = new javax.swing.JLabel();
0199:                jSpinnerNumberDecimals2 = new javax.swing.JSpinner();
0200:                jLabel9 = new javax.swing.JLabel();
0201:                jPanel3 = new javax.swing.JPanel();
0202:                jComboBoxPercentage = new javax.swing.JComboBox();
0203:                jPanelScientific = new javax.swing.JPanel();
0204:                jLabel10 = new javax.swing.JLabel();
0205:                jSpinnerNumberDecimals3 = new javax.swing.JSpinner();
0206:                jPanel10 = new javax.swing.JPanel();
0207:                jPanel4 = new javax.swing.JPanel();
0208:                jLabelSample = new javax.swing.JLabel();
0209:                jPanel8 = new javax.swing.JPanel();
0210:                jLabelPattern = new javax.swing.JLabel();
0211:                jSeparator1 = new javax.swing.JSeparator();
0212:                jPanel5 = new javax.swing.JPanel();
0213:                jPanel6 = new javax.swing.JPanel();
0214:                jButton1 = new javax.swing.JButton();
0215:                jButton2 = new javax.swing.JButton();
0216:
0217:                getContentPane().setLayout(new java.awt.GridBagLayout());
0218:
0219:                setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
0220:                setTitle("Pattern editor");
0221:                addWindowListener(new java.awt.event.WindowAdapter() {
0222:                    public void windowClosed(java.awt.event.WindowEvent evt) {
0223:                        formWindowClosed(evt);
0224:                    }
0225:                });
0226:
0227:                jPanel1.setLayout(new java.awt.GridBagLayout());
0228:
0229:                jPanel1.setPreferredSize(new java.awt.Dimension(150, 50));
0230:                jPanel1.setMinimumSize(new java.awt.Dimension(100, 50));
0231:                jLabel1.setFont(new java.awt.Font("SansSerif", 0, 11));
0232:                jLabel1.setText("Category");
0233:                gridBagConstraints = new java.awt.GridBagConstraints();
0234:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0235:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
0236:                gridBagConstraints.weightx = 1.0;
0237:                jPanel1.add(jLabel1, gridBagConstraints);
0238:
0239:                jListCategory.setFont(new java.awt.Font("SansSerif", 0, 11));
0240:                jListCategory
0241:                        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
0242:                jListCategory
0243:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0244:                            public void valueChanged(
0245:                                    javax.swing.event.ListSelectionEvent evt) {
0246:                                jListCategoryValueChanged(evt);
0247:                            }
0248:                        });
0249:
0250:                jScrollPane1.setViewportView(jListCategory);
0251:
0252:                gridBagConstraints = new java.awt.GridBagConstraints();
0253:                gridBagConstraints.gridx = 0;
0254:                gridBagConstraints.gridy = 1;
0255:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0256:                gridBagConstraints.weightx = 1.0;
0257:                gridBagConstraints.weighty = 1.0;
0258:                jPanel1.add(jScrollPane1, gridBagConstraints);
0259:
0260:                gridBagConstraints = new java.awt.GridBagConstraints();
0261:                gridBagConstraints.gridx = 0;
0262:                gridBagConstraints.gridy = 0;
0263:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0264:                gridBagConstraints.weighty = 1.0;
0265:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0266:                getContentPane().add(jPanel1, gridBagConstraints);
0267:
0268:                jPanel2.setLayout(new java.awt.GridBagLayout());
0269:
0270:                jPanelSheets.setLayout(new java.awt.BorderLayout());
0271:
0272:                jPanelNumber.setLayout(new java.awt.GridBagLayout());
0273:
0274:                jLabel2.setFont(new java.awt.Font("SansSerif", 0, 11));
0275:                jLabel2
0276:                        .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
0277:                jLabel2.setText("Decimal places:");
0278:                jLabel2.setMaximumSize(new java.awt.Dimension(75, 50));
0279:                jLabel2.setMinimumSize(new java.awt.Dimension(75, 22));
0280:                jLabel2.setPreferredSize(new java.awt.Dimension(130, 22));
0281:                gridBagConstraints = new java.awt.GridBagConstraints();
0282:                gridBagConstraints.gridx = 0;
0283:                gridBagConstraints.gridy = 0;
0284:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0285:                gridBagConstraints.weightx = 0.1;
0286:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
0287:                jPanelNumber.add(jLabel2, gridBagConstraints);
0288:
0289:                jSpinnerNumberDecimals.setFont(new java.awt.Font("SansSerif",
0290:                        0, 11));
0291:                jSpinnerNumberDecimals.setMinimumSize(new java.awt.Dimension(
0292:                        27, 22));
0293:                jSpinnerNumberDecimals.setPreferredSize(new java.awt.Dimension(
0294:                        100, 22));
0295:                jSpinnerNumberDecimals
0296:                        .addPropertyChangeListener(new java.beans.PropertyChangeListener() {
0297:                            public void propertyChange(
0298:                                    java.beans.PropertyChangeEvent evt) {
0299:                                jSpinnerNumberDecimalsPropertyChange(evt);
0300:                            }
0301:                        });
0302:                jSpinnerNumberDecimals
0303:                        .addChangeListener(new javax.swing.event.ChangeListener() {
0304:                            public void stateChanged(
0305:                                    javax.swing.event.ChangeEvent evt) {
0306:                                jSpinnerNumberDecimalsStateChanged(evt);
0307:                            }
0308:                        });
0309:
0310:                gridBagConstraints = new java.awt.GridBagConstraints();
0311:                gridBagConstraints.gridx = 1;
0312:                gridBagConstraints.gridy = 0;
0313:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
0314:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
0315:                gridBagConstraints.weightx = 0.5;
0316:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
0317:                jPanelNumber.add(jSpinnerNumberDecimals, gridBagConstraints);
0318:
0319:                jLabel3.setFont(new java.awt.Font("SansSerif", 0, 11));
0320:                jLabel3
0321:                        .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
0322:                jLabel3.setText("Use 1000 separator");
0323:                jLabel3.setMaximumSize(new java.awt.Dimension(75, 50));
0324:                jLabel3.setMinimumSize(new java.awt.Dimension(75, 22));
0325:                jLabel3.setPreferredSize(new java.awt.Dimension(130, 22));
0326:                gridBagConstraints = new java.awt.GridBagConstraints();
0327:                gridBagConstraints.gridx = 0;
0328:                gridBagConstraints.gridy = 1;
0329:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0330:                gridBagConstraints.weightx = 0.1;
0331:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
0332:                jPanelNumber.add(jLabel3, gridBagConstraints);
0333:
0334:                jCheckBox1
0335:                        .addActionListener(new java.awt.event.ActionListener() {
0336:                            public void actionPerformed(
0337:                                    java.awt.event.ActionEvent evt) {
0338:                                jCheckBox1ActionPerformed(evt);
0339:                            }
0340:                        });
0341:
0342:                gridBagConstraints = new java.awt.GridBagConstraints();
0343:                gridBagConstraints.gridx = 1;
0344:                gridBagConstraints.gridy = 1;
0345:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0346:                jPanelNumber.add(jCheckBox1, gridBagConstraints);
0347:
0348:                jLabel4.setFont(new java.awt.Font("SansSerif", 0, 11));
0349:                jLabel4
0350:                        .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
0351:                jLabel4.setText("Negative numbers:");
0352:                jLabel4.setMaximumSize(new java.awt.Dimension(75, 50));
0353:                jLabel4.setMinimumSize(new java.awt.Dimension(75, 22));
0354:                jLabel4.setPreferredSize(new java.awt.Dimension(130, 22));
0355:                gridBagConstraints = new java.awt.GridBagConstraints();
0356:                gridBagConstraints.gridx = 0;
0357:                gridBagConstraints.gridy = 2;
0358:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0359:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0360:                gridBagConstraints.weightx = 0.1;
0361:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
0362:                jPanelNumber.add(jLabel4, gridBagConstraints);
0363:
0364:                gridBagConstraints = new java.awt.GridBagConstraints();
0365:                gridBagConstraints.gridx = 0;
0366:                gridBagConstraints.gridwidth = 2;
0367:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0368:                gridBagConstraints.weightx = 1.0;
0369:                gridBagConstraints.weighty = 1.0;
0370:                jPanelNumber.add(jPanel7, gridBagConstraints);
0371:
0372:                jScrollPane2.setPreferredSize(new java.awt.Dimension(100, 120));
0373:                jScrollPane2.setMinimumSize(new java.awt.Dimension(100, 50));
0374:                jListNegatives.setFont(new java.awt.Font("SansSerif", 0, 11));
0375:                jListNegatives
0376:                        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
0377:                jListNegatives
0378:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0379:                            public void valueChanged(
0380:                                    javax.swing.event.ListSelectionEvent evt) {
0381:                                jListNegativesValueChanged(evt);
0382:                            }
0383:                        });
0384:
0385:                jScrollPane2.setViewportView(jListNegatives);
0386:
0387:                gridBagConstraints = new java.awt.GridBagConstraints();
0388:                gridBagConstraints.gridx = 1;
0389:                gridBagConstraints.gridy = 2;
0390:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
0391:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
0392:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
0393:                jPanelNumber.add(jScrollPane2, gridBagConstraints);
0394:
0395:                jPanelSheets.add(jPanelNumber, java.awt.BorderLayout.CENTER);
0396:
0397:                jPanelDate.setLayout(new java.awt.GridBagLayout());
0398:
0399:                jLabel7.setFont(new java.awt.Font("SansSerif", 0, 11));
0400:                jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
0401:                jLabel7.setText("Type:");
0402:                jLabel7.setPreferredSize(new java.awt.Dimension(100, 22));
0403:                jLabel7.setMaximumSize(new java.awt.Dimension(75, 50));
0404:                jLabel7.setMinimumSize(new java.awt.Dimension(75, 22));
0405:                jLabel7
0406:                        .setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
0407:                gridBagConstraints = new java.awt.GridBagConstraints();
0408:                gridBagConstraints.gridx = 0;
0409:                gridBagConstraints.gridy = 0;
0410:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0411:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0412:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
0413:                jPanelDate.add(jLabel7, gridBagConstraints);
0414:
0415:                jScrollPane3.setPreferredSize(new java.awt.Dimension(300, 120));
0416:                jScrollPane3.setMinimumSize(new java.awt.Dimension(200, 50));
0417:                jListDateTypes.setFont(new java.awt.Font("SansSerif", 0, 11));
0418:                jListDateTypes
0419:                        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
0420:                jListDateTypes
0421:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0422:                            public void valueChanged(
0423:                                    javax.swing.event.ListSelectionEvent evt) {
0424:                                jListDateTypesValueChanged(evt);
0425:                            }
0426:                        });
0427:
0428:                jScrollPane3.setViewportView(jListDateTypes);
0429:
0430:                gridBagConstraints = new java.awt.GridBagConstraints();
0431:                gridBagConstraints.gridx = 0;
0432:                gridBagConstraints.gridy = 1;
0433:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
0434:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0435:                gridBagConstraints.weightx = 1.0;
0436:                gridBagConstraints.weighty = 1.0;
0437:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0);
0438:                jPanelDate.add(jScrollPane3, gridBagConstraints);
0439:
0440:                jPanelSheets.add(jPanelDate, java.awt.BorderLayout.CENTER);
0441:
0442:                jPanelTime.setLayout(new java.awt.GridBagLayout());
0443:
0444:                jLabel8.setFont(new java.awt.Font("SansSerif", 0, 11));
0445:                jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
0446:                jLabel8.setText("Type:");
0447:                jLabel8.setPreferredSize(new java.awt.Dimension(100, 22));
0448:                jLabel8.setMaximumSize(new java.awt.Dimension(75, 50));
0449:                jLabel8.setMinimumSize(new java.awt.Dimension(75, 22));
0450:                jLabel8
0451:                        .setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
0452:                gridBagConstraints = new java.awt.GridBagConstraints();
0453:                gridBagConstraints.gridx = 0;
0454:                gridBagConstraints.gridy = 0;
0455:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0456:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0457:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
0458:                jPanelTime.add(jLabel8, gridBagConstraints);
0459:
0460:                jScrollPane4.setPreferredSize(new java.awt.Dimension(300, 120));
0461:                jScrollPane4.setMinimumSize(new java.awt.Dimension(200, 50));
0462:                jListTimeTypes.setFont(new java.awt.Font("SansSerif", 0, 11));
0463:                jListTimeTypes
0464:                        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
0465:                jListTimeTypes
0466:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0467:                            public void valueChanged(
0468:                                    javax.swing.event.ListSelectionEvent evt) {
0469:                                jListTimeTypesValueChanged(evt);
0470:                            }
0471:                        });
0472:
0473:                jScrollPane4.setViewportView(jListTimeTypes);
0474:
0475:                gridBagConstraints = new java.awt.GridBagConstraints();
0476:                gridBagConstraints.gridx = 0;
0477:                gridBagConstraints.gridy = 1;
0478:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
0479:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0480:                gridBagConstraints.weightx = 1.0;
0481:                gridBagConstraints.weighty = 1.0;
0482:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0);
0483:                jPanelTime.add(jScrollPane4, gridBagConstraints);
0484:
0485:                jPanelSheets.add(jPanelTime, java.awt.BorderLayout.CENTER);
0486:
0487:                jPanelCurrency.setLayout(new java.awt.GridBagLayout());
0488:
0489:                jLabel5.setFont(new java.awt.Font("SansSerif", 0, 11));
0490:                jLabel5
0491:                        .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
0492:                jLabel5.setText("Decimal places:");
0493:                jLabel5.setPreferredSize(new java.awt.Dimension(130, 22));
0494:                jLabel5.setMaximumSize(new java.awt.Dimension(75, 50));
0495:                jLabel5.setMinimumSize(new java.awt.Dimension(75, 22));
0496:                gridBagConstraints = new java.awt.GridBagConstraints();
0497:                gridBagConstraints.gridx = 0;
0498:                gridBagConstraints.gridy = 0;
0499:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0500:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
0501:                jPanelCurrency.add(jLabel5, gridBagConstraints);
0502:
0503:                jSpinnerNumberDecimals1.setFont(new java.awt.Font("SansSerif",
0504:                        0, 11));
0505:                jSpinnerNumberDecimals1
0506:                        .setPreferredSize(new java.awt.Dimension(100, 22));
0507:                jSpinnerNumberDecimals1.setMinimumSize(new java.awt.Dimension(
0508:                        27, 22));
0509:                gridBagConstraints = new java.awt.GridBagConstraints();
0510:                gridBagConstraints.gridx = 1;
0511:                gridBagConstraints.gridy = 0;
0512:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
0513:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
0514:                gridBagConstraints.weightx = 0.5;
0515:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
0516:                jPanelCurrency.add(jSpinnerNumberDecimals1, gridBagConstraints);
0517:
0518:                gridBagConstraints = new java.awt.GridBagConstraints();
0519:                gridBagConstraints.gridx = 0;
0520:                gridBagConstraints.gridwidth = 2;
0521:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0522:                gridBagConstraints.weightx = 1.0;
0523:                gridBagConstraints.weighty = 1.0;
0524:                jPanelCurrency.add(jPanel9, gridBagConstraints);
0525:
0526:                jPanelSheets.add(jPanelCurrency, java.awt.BorderLayout.CENTER);
0527:
0528:                jPanelPercentage.setLayout(new java.awt.GridBagLayout());
0529:
0530:                jLabel6.setFont(new java.awt.Font("SansSerif", 0, 11));
0531:                jLabel6
0532:                        .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
0533:                jLabel6.setText("Decimal places:");
0534:                jLabel6.setPreferredSize(new java.awt.Dimension(130, 22));
0535:                jLabel6.setMaximumSize(new java.awt.Dimension(75, 50));
0536:                jLabel6.setMinimumSize(new java.awt.Dimension(75, 22));
0537:                gridBagConstraints = new java.awt.GridBagConstraints();
0538:                gridBagConstraints.gridx = 0;
0539:                gridBagConstraints.gridy = 0;
0540:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0541:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
0542:                jPanelPercentage.add(jLabel6, gridBagConstraints);
0543:
0544:                jSpinnerNumberDecimals2.setFont(new java.awt.Font("SansSerif",
0545:                        0, 11));
0546:                jSpinnerNumberDecimals2
0547:                        .setPreferredSize(new java.awt.Dimension(100, 22));
0548:                jSpinnerNumberDecimals2.setMinimumSize(new java.awt.Dimension(
0549:                        27, 22));
0550:                gridBagConstraints = new java.awt.GridBagConstraints();
0551:                gridBagConstraints.gridx = 1;
0552:                gridBagConstraints.gridy = 0;
0553:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
0554:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
0555:                gridBagConstraints.weightx = 0.5;
0556:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
0557:                jPanelPercentage.add(jSpinnerNumberDecimals2,
0558:                        gridBagConstraints);
0559:
0560:                jLabel9.setFont(new java.awt.Font("SansSerif", 0, 11));
0561:                jLabel9
0562:                        .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
0563:                jLabel9.setText("Type:");
0564:                jLabel9.setPreferredSize(new java.awt.Dimension(130, 22));
0565:                jLabel9.setMaximumSize(new java.awt.Dimension(75, 50));
0566:                jLabel9.setMinimumSize(new java.awt.Dimension(75, 22));
0567:                gridBagConstraints = new java.awt.GridBagConstraints();
0568:                gridBagConstraints.gridx = 0;
0569:                gridBagConstraints.gridy = 1;
0570:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0571:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
0572:                jPanelPercentage.add(jLabel9, gridBagConstraints);
0573:
0574:                gridBagConstraints = new java.awt.GridBagConstraints();
0575:                gridBagConstraints.gridx = 0;
0576:                gridBagConstraints.gridy = 2;
0577:                gridBagConstraints.gridwidth = 2;
0578:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0579:                gridBagConstraints.weightx = 1.0;
0580:                gridBagConstraints.weighty = 1.0;
0581:                jPanelPercentage.add(jPanel3, gridBagConstraints);
0582:
0583:                jComboBoxPercentage.setFont(new java.awt.Font("SansSerif", 0,
0584:                        12));
0585:                jComboBoxPercentage.setPreferredSize(new java.awt.Dimension(
0586:                        100, 20));
0587:                jComboBoxPercentage
0588:                        .addActionListener(new java.awt.event.ActionListener() {
0589:                            public void actionPerformed(
0590:                                    java.awt.event.ActionEvent evt) {
0591:                                jComboBoxPercentageActionPerformed(evt);
0592:                            }
0593:                        });
0594:
0595:                gridBagConstraints = new java.awt.GridBagConstraints();
0596:                gridBagConstraints.gridx = 1;
0597:                gridBagConstraints.gridy = 1;
0598:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0599:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 0);
0600:                jPanelPercentage.add(jComboBoxPercentage, gridBagConstraints);
0601:
0602:                jPanelSheets
0603:                        .add(jPanelPercentage, java.awt.BorderLayout.CENTER);
0604:
0605:                jPanelScientific.setLayout(new java.awt.GridBagLayout());
0606:
0607:                jLabel10.setFont(new java.awt.Font("SansSerif", 0, 11));
0608:                jLabel10
0609:                        .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
0610:                jLabel10.setText("Decimal places:");
0611:                jLabel10.setPreferredSize(new java.awt.Dimension(130, 22));
0612:                jLabel10.setMaximumSize(new java.awt.Dimension(75, 50));
0613:                jLabel10.setMinimumSize(new java.awt.Dimension(75, 22));
0614:                gridBagConstraints = new java.awt.GridBagConstraints();
0615:                gridBagConstraints.gridx = 0;
0616:                gridBagConstraints.gridy = 0;
0617:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0618:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
0619:                jPanelScientific.add(jLabel10, gridBagConstraints);
0620:
0621:                jSpinnerNumberDecimals3.setFont(new java.awt.Font("SansSerif",
0622:                        0, 11));
0623:                jSpinnerNumberDecimals3
0624:                        .setPreferredSize(new java.awt.Dimension(100, 22));
0625:                jSpinnerNumberDecimals3.setMinimumSize(new java.awt.Dimension(
0626:                        27, 22));
0627:                gridBagConstraints = new java.awt.GridBagConstraints();
0628:                gridBagConstraints.gridx = 1;
0629:                gridBagConstraints.gridy = 0;
0630:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
0631:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
0632:                gridBagConstraints.weightx = 0.5;
0633:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
0634:                jPanelScientific.add(jSpinnerNumberDecimals3,
0635:                        gridBagConstraints);
0636:
0637:                gridBagConstraints = new java.awt.GridBagConstraints();
0638:                gridBagConstraints.gridx = 0;
0639:                gridBagConstraints.gridwidth = 2;
0640:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0641:                gridBagConstraints.weightx = 1.0;
0642:                gridBagConstraints.weighty = 1.0;
0643:                jPanelScientific.add(jPanel10, gridBagConstraints);
0644:
0645:                jPanelSheets
0646:                        .add(jPanelScientific, java.awt.BorderLayout.CENTER);
0647:
0648:                gridBagConstraints = new java.awt.GridBagConstraints();
0649:                gridBagConstraints.gridx = 0;
0650:                gridBagConstraints.gridy = 1;
0651:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0652:                gridBagConstraints.weightx = 1.0;
0653:                gridBagConstraints.weighty = 1.0;
0654:                gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
0655:                jPanel2.add(jPanelSheets, gridBagConstraints);
0656:
0657:                jPanel4.setLayout(new java.awt.GridBagLayout());
0658:
0659:                jPanel4.setBorder(javax.swing.BorderFactory
0660:                        .createTitledBorder("Sample"));
0661:                jLabelSample.setFont(new java.awt.Font("SansSerif", 0, 12));
0662:                jLabelSample.setPreferredSize(new java.awt.Dimension(34, 20));
0663:                jLabelSample.setMaximumSize(new java.awt.Dimension(34, 50));
0664:                jLabelSample.setMinimumSize(new java.awt.Dimension(34, 20));
0665:                gridBagConstraints = new java.awt.GridBagConstraints();
0666:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0667:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
0668:                gridBagConstraints.weightx = 1.0;
0669:                gridBagConstraints.weighty = 1.0;
0670:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
0671:                jPanel4.add(jLabelSample, gridBagConstraints);
0672:
0673:                gridBagConstraints = new java.awt.GridBagConstraints();
0674:                gridBagConstraints.gridx = 0;
0675:                gridBagConstraints.gridy = 0;
0676:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0677:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
0678:                gridBagConstraints.weightx = 1.0;
0679:                jPanel2.add(jPanel4, gridBagConstraints);
0680:
0681:                jPanel8.setLayout(new java.awt.GridBagLayout());
0682:
0683:                jPanel8.setBorder(javax.swing.BorderFactory
0684:                        .createTitledBorder("Pattern"));
0685:                jLabelPattern.setFont(new java.awt.Font("SansSerif", 0, 12));
0686:                jLabelPattern.setPreferredSize(new java.awt.Dimension(34, 20));
0687:                jLabelPattern.setMaximumSize(new java.awt.Dimension(34, 50));
0688:                jLabelPattern.setMinimumSize(new java.awt.Dimension(34, 20));
0689:                gridBagConstraints = new java.awt.GridBagConstraints();
0690:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0691:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
0692:                gridBagConstraints.weightx = 1.0;
0693:                gridBagConstraints.weighty = 1.0;
0694:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
0695:                jPanel8.add(jLabelPattern, gridBagConstraints);
0696:
0697:                gridBagConstraints = new java.awt.GridBagConstraints();
0698:                gridBagConstraints.gridx = 0;
0699:                gridBagConstraints.gridy = 2;
0700:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0701:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
0702:                gridBagConstraints.weightx = 1.0;
0703:                jPanel2.add(jPanel8, gridBagConstraints);
0704:
0705:                gridBagConstraints = new java.awt.GridBagConstraints();
0706:                gridBagConstraints.gridx = 0;
0707:                gridBagConstraints.gridy = 3;
0708:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0709:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
0710:                jPanel2.add(jSeparator1, gridBagConstraints);
0711:
0712:                gridBagConstraints = new java.awt.GridBagConstraints();
0713:                gridBagConstraints.gridx = 1;
0714:                gridBagConstraints.gridy = 0;
0715:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0716:                gridBagConstraints.weightx = 1.0;
0717:                gridBagConstraints.weighty = 1.0;
0718:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
0719:                getContentPane().add(jPanel2, gridBagConstraints);
0720:
0721:                jPanel5.setLayout(new java.awt.GridBagLayout());
0722:
0723:                jPanel5.setPreferredSize(new java.awt.Dimension(10, 30));
0724:                gridBagConstraints = new java.awt.GridBagConstraints();
0725:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0726:                gridBagConstraints.weightx = 1.0;
0727:                gridBagConstraints.weighty = 1.0;
0728:                jPanel5.add(jPanel6, gridBagConstraints);
0729:
0730:                jButton1.setFont(new java.awt.Font("SansSerif", 0, 11));
0731:                jButton1.setText("Apply");
0732:                jButton1.addActionListener(new java.awt.event.ActionListener() {
0733:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
0734:                        jButton1ActionPerformed(evt);
0735:                    }
0736:                });
0737:
0738:                gridBagConstraints = new java.awt.GridBagConstraints();
0739:                gridBagConstraints.gridx = 1;
0740:                gridBagConstraints.gridy = 0;
0741:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0742:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
0743:                jPanel5.add(jButton1, gridBagConstraints);
0744:
0745:                jButton2.setFont(new java.awt.Font("SansSerif", 0, 11));
0746:                jButton2.setText("Cancel");
0747:                jButton2.addActionListener(new java.awt.event.ActionListener() {
0748:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
0749:                        jButton2ActionPerformed(evt);
0750:                    }
0751:                });
0752:
0753:                gridBagConstraints = new java.awt.GridBagConstraints();
0754:                gridBagConstraints.gridx = 2;
0755:                gridBagConstraints.gridy = 0;
0756:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
0757:                jPanel5.add(jButton2, gridBagConstraints);
0758:
0759:                gridBagConstraints = new java.awt.GridBagConstraints();
0760:                gridBagConstraints.gridx = 0;
0761:                gridBagConstraints.gridy = 1;
0762:                gridBagConstraints.gridwidth = 2;
0763:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0764:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
0765:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
0766:                getContentPane().add(jPanel5, gridBagConstraints);
0767:
0768:                pack();
0769:            }// </editor-fold>//GEN-END:initComponents
0770:
0771:            private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
0772:                // TODO add your handling code here:
0773:            }//GEN-LAST:event_formWindowClosed
0774:
0775:            private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
0776:                this .setPattern(jLabelPattern.getText());
0777:                setDialogResult(javax.swing.JOptionPane.OK_OPTION);
0778:                this .setVisible(false);
0779:                this .dispose();
0780:            }//GEN-LAST:event_jButton1ActionPerformed
0781:
0782:            private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
0783:
0784:                setDialogResult(javax.swing.JOptionPane.CANCEL_OPTION);
0785:                this .setVisible(false);
0786:                this .dispose();
0787:            }//GEN-LAST:event_jButton2ActionPerformed
0788:
0789:            private void jComboBoxPercentageActionPerformed(
0790:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxPercentageActionPerformed
0791:                updateSample();
0792:            }//GEN-LAST:event_jComboBoxPercentageActionPerformed
0793:
0794:            private void jListTimeTypesValueChanged(
0795:                    javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListTimeTypesValueChanged
0796:                updateSample();
0797:            }//GEN-LAST:event_jListTimeTypesValueChanged
0798:
0799:            private void jListDateTypesValueChanged(
0800:                    javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListDateTypesValueChanged
0801:                updateSample();
0802:            }//GEN-LAST:event_jListDateTypesValueChanged
0803:
0804:            private void jListNegativesValueChanged(
0805:                    javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListNegativesValueChanged
0806:
0807:                updateSample();
0808:
0809:            }//GEN-LAST:event_jListNegativesValueChanged
0810:
0811:            private void jSpinnerNumberDecimalsStateChanged(
0812:                    javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinnerNumberDecimalsStateChanged
0813:                updateSample();
0814:                updateListNegatives();
0815:            }//GEN-LAST:event_jSpinnerNumberDecimalsStateChanged
0816:
0817:            private void jCheckBox1ActionPerformed(
0818:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
0819:                updateSample();
0820:                updateListNegatives();
0821:            }//GEN-LAST:event_jCheckBox1ActionPerformed
0822:
0823:            private void jListCategoryValueChanged(
0824:                    javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListCategoryValueChanged
0825:
0826:                int i = getSelectedCategory();
0827:
0828:                if (i != selectedCategory) {
0829:                    selectedCategory = i;
0830:                    jPanelSheets.removeAll();
0831:                    if (i == 0) {
0832:                        jPanelSheets.add(jPanelNumber);
0833:                        updateSample();
0834:                    } else if (i == 1) {
0835:                        jPanelSheets.add(jPanelDate);
0836:                        updateSample();
0837:                    } else if (i == 2) {
0838:                        jPanelSheets.add(jPanelTime);
0839:                        updateSample();
0840:                    } else if (i == 3) {
0841:                        jPanelSheets.add(jPanelCurrency);
0842:                        updateSample();
0843:                    } else if (i == 4) {
0844:                        jPanelSheets.add(jPanelPercentage);
0845:                        updateSample();
0846:                    } else if (i == 5) {
0847:                        jPanelSheets.add(jPanelScientific);
0848:                        updateSample();
0849:                    } else {
0850:                        updateSample();
0851:                    }
0852:                    jPanelSheets.updateUI();
0853:                }
0854:
0855:            }//GEN-LAST:event_jListCategoryValueChanged
0856:
0857:            private void jSpinnerNumberDecimalsPropertyChange(
0858:                    java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jSpinnerNumberDecimalsPropertyChange
0859:
0860:            }//GEN-LAST:event_jSpinnerNumberDecimalsPropertyChange
0861:
0862:            /**
0863:             * @param args the command line arguments
0864:             */
0865:            public static void main(String args[]) {
0866:                new FieldPatternDialog(new javax.swing.JFrame(), true)
0867:                        .setVisible(true);
0868:            }
0869:
0870:            // Variables declaration - do not modify//GEN-BEGIN:variables
0871:            private javax.swing.JButton jButton1;
0872:            private javax.swing.JButton jButton2;
0873:            private javax.swing.JCheckBox jCheckBox1;
0874:            private javax.swing.JComboBox jComboBoxPercentage;
0875:            private javax.swing.JLabel jLabel1;
0876:            private javax.swing.JLabel jLabel10;
0877:            private javax.swing.JLabel jLabel2;
0878:            private javax.swing.JLabel jLabel3;
0879:            private javax.swing.JLabel jLabel4;
0880:            private javax.swing.JLabel jLabel5;
0881:            private javax.swing.JLabel jLabel6;
0882:            private javax.swing.JLabel jLabel7;
0883:            private javax.swing.JLabel jLabel8;
0884:            private javax.swing.JLabel jLabel9;
0885:            private javax.swing.JLabel jLabelPattern;
0886:            private javax.swing.JLabel jLabelSample;
0887:            private javax.swing.JList jListCategory;
0888:            private javax.swing.JList jListDateTypes;
0889:            private javax.swing.JList jListNegatives;
0890:            private javax.swing.JList jListTimeTypes;
0891:            private javax.swing.JPanel jPanel1;
0892:            private javax.swing.JPanel jPanel10;
0893:            private javax.swing.JPanel jPanel2;
0894:            private javax.swing.JPanel jPanel3;
0895:            private javax.swing.JPanel jPanel4;
0896:            private javax.swing.JPanel jPanel5;
0897:            private javax.swing.JPanel jPanel6;
0898:            private javax.swing.JPanel jPanel7;
0899:            private javax.swing.JPanel jPanel8;
0900:            private javax.swing.JPanel jPanel9;
0901:            private javax.swing.JPanel jPanelCurrency;
0902:            private javax.swing.JPanel jPanelDate;
0903:            private javax.swing.JPanel jPanelNumber;
0904:            private javax.swing.JPanel jPanelPercentage;
0905:            private javax.swing.JPanel jPanelScientific;
0906:            private javax.swing.JPanel jPanelSheets;
0907:            private javax.swing.JPanel jPanelTime;
0908:            private javax.swing.JScrollPane jScrollPane1;
0909:            private javax.swing.JScrollPane jScrollPane2;
0910:            private javax.swing.JScrollPane jScrollPane3;
0911:            private javax.swing.JScrollPane jScrollPane4;
0912:            private javax.swing.JSeparator jSeparator1;
0913:            private javax.swing.JSpinner jSpinnerNumberDecimals;
0914:            private javax.swing.JSpinner jSpinnerNumberDecimals1;
0915:            private javax.swing.JSpinner jSpinnerNumberDecimals2;
0916:            private javax.swing.JSpinner jSpinnerNumberDecimals3;
0917:
0918:            // End of variables declaration//GEN-END:variables
0919:
0920:            private void updateSample() {
0921:                String format = createPattern();
0922:
0923:                int i = getSelectedCategory();
0924:                if (i == 0) {
0925:                    java.text.DecimalFormat nf = new java.text.DecimalFormat(
0926:                            format);
0927:                    jLabelSample.setText(nf.format(1234.43210));
0928:                } else if (i == 1) {
0929:                    if (jListDateTypes.getSelectedIndex() >= 0) {
0930:                        jLabelSample.setText(""
0931:                                + jListDateTypes.getSelectedValue());
0932:                    } else
0933:                        jLabelSample.setText("");
0934:                } else if (i == 2) {
0935:                    if (jListTimeTypes.getSelectedIndex() >= 0) {
0936:                        jLabelSample.setText(""
0937:                                + jListTimeTypes.getSelectedValue());
0938:                    } else
0939:                        jLabelSample.setText("");
0940:                } else if (i == 3) {
0941:                    java.text.DecimalFormat nf = new java.text.DecimalFormat(
0942:                            format);
0943:                    jLabelSample.setText(nf.format(1234.43210));
0944:
0945:                } else if (i == 4) {
0946:                    java.text.DecimalFormat nf = new java.text.DecimalFormat(
0947:                            format);
0948:                    jLabelSample.setText(nf.format(1234.43210));
0949:
0950:                } else if (i == 5) {
0951:                    java.text.DecimalFormat nf = new java.text.DecimalFormat(
0952:                            format);
0953:                    jLabelSample.setText(nf.format(1234.43210));
0954:
0955:                } else {
0956:                    jLabelSample.setText("");
0957:                }
0958:            }
0959:
0960:            private String createPattern() {
0961:                String format = "";
0962:                int cat = getSelectedCategory();
0963:                // NUMBER FORMATS
0964:                if (cat == 0) {
0965:                    //format = "###0";
0966:                    if (jCheckBox1.isSelected()) {
0967:                        format = "#,##0";
0968:                    } else {
0969:                        format = "###0";
0970:                    }
0971:                    int decimals = ((javax.swing.SpinnerNumberModel) jSpinnerNumberDecimals
0972:                            .getModel()).getNumber().intValue();
0973:                    if (decimals > 0) {
0974:                        format += ".";
0975:                        for (int i = 0; i < decimals; ++i) {
0976:                            format += "0";
0977:                        }
0978:                    }
0979:                    if (jListNegatives.getSelectedIndex() >= 0) {
0980:                        int selectedIndex = jListNegatives.getSelectedIndex();
0981:                        if (selectedIndex == 0)
0982:                            format += ";-" + format + "";
0983:                        if (selectedIndex == 1)
0984:                            format += ";" + format + "-";
0985:                        if (selectedIndex == 2)
0986:                            format += ";(" + format + ")";
0987:                        if (selectedIndex == 3)
0988:                            format += ";(-" + format + ")";
0989:                        if (selectedIndex == 4)
0990:                            format += ";(" + format + "-)";
0991:                    }
0992:                } else if (cat == 1) {
0993:                    if (jListDateTypes.getSelectedIndex() >= 0) {
0994:                        format = dateFormats[jListDateTypes.getSelectedIndex()];
0995:                    }
0996:                } else if (cat == 2) {
0997:                    if (jListTimeTypes.getSelectedIndex() >= 0) {
0998:                        format = timeFormats[jListTimeTypes.getSelectedIndex()];
0999:                    }
1000:                } else if (cat == 3) {
1001:                    format = "\u00A4 #,##0";
1002:                    int decimals = ((javax.swing.SpinnerNumberModel) jSpinnerNumberDecimals1
1003:                            .getModel()).getNumber().intValue();
1004:                    if (decimals > 0) {
1005:                        format += ".";
1006:                        for (int i = 0; i < decimals; ++i) {
1007:                            format += "0";
1008:                        }
1009:                    }
1010:                } else if (cat == 4) {
1011:                    format = "#,##0";
1012:                    int decimals = ((javax.swing.SpinnerNumberModel) jSpinnerNumberDecimals2
1013:                            .getModel()).getNumber().intValue();
1014:                    if (decimals > 0) {
1015:                        format += ".";
1016:                        for (int i = 0; i < decimals; ++i) {
1017:                            format += "0";
1018:                        }
1019:                    }
1020:                    format += " " + jComboBoxPercentage.getSelectedItem();
1021:                } else if (cat == 5) {
1022:                    format = "0";
1023:                    int decimals = ((javax.swing.SpinnerNumberModel) jSpinnerNumberDecimals3
1024:                            .getModel()).getNumber().intValue();
1025:                    if (decimals > 0) {
1026:                        format += ".0";
1027:                        for (int i = 1; i < decimals; ++i) {
1028:                            format += "#";
1029:                        }
1030:                    }
1031:                    format += "E0";
1032:                }
1033:
1034:                jLabelPattern.setText(format);
1035:                return format;
1036:            }
1037:
1038:            private void updateListNegatives() {
1039:                String format = createPattern();
1040:                javax.swing.DefaultListModel dlm = (javax.swing.DefaultListModel) jListNegatives
1041:                        .getModel();
1042:                int selected = jListNegatives.getSelectedIndex();
1043:                dlm.removeAllElements();
1044:                if (format.indexOf(";") >= 0) {
1045:                    format = format.substring(0, format.indexOf(";"));
1046:                }
1047:                String[] formats = new String[5];
1048:
1049:                formats[0] = format + ";-" + format + "";
1050:                formats[1] = format + ";" + format + "-";
1051:                formats[2] = format + ";(" + format + ")";
1052:                formats[3] = format + ";(-" + format + ")";
1053:                formats[4] = format + ";(" + format + "-)";
1054:
1055:                for (int i = 0; i < formats.length; ++i) {
1056:                    java.text.DecimalFormat nf = new java.text.DecimalFormat(
1057:                            formats[i]);
1058:                    dlm.addElement(nf.format(-1234.43210));
1059:                }
1060:                if (selected >= 0) {
1061:                    jListNegatives.setSelectedIndex(selected);
1062:                }
1063:
1064:            }
1065:
1066:            private void updateListDateTypes() {
1067:                javax.swing.DefaultListModel dlm = (javax.swing.DefaultListModel) jListDateTypes
1068:                        .getModel();
1069:
1070:                for (int i = 0; i < dateFormats.length; ++i) {
1071:                    java.text.SimpleDateFormat nf = new java.text.SimpleDateFormat(
1072:                            dateFormats[i]);
1073:                    dlm.addElement(nf.format(new java.util.Date()));
1074:                }
1075:                jListDateTypes.setSelectedIndex(0);
1076:
1077:            }
1078:
1079:            private void updateListTimeTypes() {
1080:                javax.swing.DefaultListModel dlm = (javax.swing.DefaultListModel) jListTimeTypes
1081:                        .getModel();
1082:
1083:                for (int i = 0; i < timeFormats.length; ++i) {
1084:                    java.text.SimpleDateFormat nf = new java.text.SimpleDateFormat(
1085:                            timeFormats[i]);
1086:                    dlm.addElement(nf.format(new java.util.Date()));
1087:                }
1088:                jListTimeTypes.setSelectedIndex(0);
1089:
1090:            }
1091:
1092:            /**
1093:             * Getter for property dialogResult.
1094:             * @return Value of property dialogResult.
1095:             */
1096:            public int getDialogResult() {
1097:                return dialogResult;
1098:            }
1099:
1100:            /**
1101:             * Setter for property dialogResult.
1102:             * @param dialogResult New value of property dialogResult.
1103:             */
1104:            public void setDialogResult(int dialogResult) {
1105:                this .dialogResult = dialogResult;
1106:            }
1107:
1108:            /**
1109:             * Getter for property pattern.
1110:             * @return Value of property pattern.
1111:             */
1112:            public java.lang.String getPattern() {
1113:                return pattern;
1114:            }
1115:
1116:            /**
1117:             * Setter for property pattern.
1118:             * @param pattern New value of property pattern.
1119:             */
1120:            public void setPattern(java.lang.String pattern) {
1121:                this .pattern = pattern;
1122:            }
1123:
1124:            public int getSelectedCategory() {
1125:                int i = 0;
1126:                String category = "" + jListCategory.getSelectedValue();
1127:
1128:                if (category.equals("Number"))
1129:                    i = 0; // 0
1130:                if (category.equals("Date"))
1131:                    i = 1; // 0
1132:                if (category.equals("Time"))
1133:                    i = 2; // 0
1134:                if (category.equals("Currency"))
1135:                    i = 3; // 0
1136:                if (category.equals("Percentage"))
1137:                    i = 4; // 0
1138:                if (category.equals("Scientific"))
1139:                    i = 5; // 0
1140:
1141:                return i;
1142:            }
1143:
1144:            public void applyI18n() {
1145:                // Start autogenerated code ----------------------
1146:                // End autogenerated code ----------------------
1147:                // Start autogenerated code ----------------------
1148:                jButton1.setText(I18n.getString("fieldPatternDialog.button1",
1149:                        "Apply"));
1150:                jButton2.setText(I18n.getString("fieldPatternDialog.button2",
1151:                        "Cancel"));
1152:                jLabel1.setText(I18n.getString("fieldPatternDialog.label1",
1153:                        "Category"));
1154:                jLabel10.setText(I18n.getString("fieldPatternDialog.label10",
1155:                        "Decimal places:"));
1156:                jLabel2.setText(I18n.getString("fieldPatternDialog.label2",
1157:                        "Decimal places:"));
1158:                jLabel3.setText(I18n.getString("fieldPatternDialog.label3",
1159:                        "Use 1000 separator"));
1160:                jLabel4.setText(I18n.getString("fieldPatternDialog.label4",
1161:                        "Negative numbers:"));
1162:                jLabel5.setText(I18n.getString("fieldPatternDialog.label5",
1163:                        "Decimal places:"));
1164:                jLabel6.setText(I18n.getString("fieldPatternDialog.label6",
1165:                        "Decimal places:"));
1166:                jLabel7.setText(I18n.getString("fieldPatternDialog.label7",
1167:                        "Type:"));
1168:                jLabel8.setText(I18n.getString("fieldPatternDialog.label8",
1169:                        "Type:"));
1170:                jLabel9.setText(I18n.getString("fieldPatternDialog.label9",
1171:                        "Type:"));
1172:                // End autogenerated code ----------------------
1173:                ((javax.swing.border.TitledBorder) jPanel4.getBorder())
1174:                        .setTitle(it.businesslogic.ireport.util.I18n.getString(
1175:                                "fieldPatternDialog.panelBorder.Sample",
1176:                                "Sample"));
1177:                ((javax.swing.border.TitledBorder) jPanel8.getBorder())
1178:                        .setTitle(it.businesslogic.ireport.util.I18n.getString(
1179:                                "fieldPatternDialog.panelBorder.Pattern",
1180:                                "Pattern"));
1181:                setTitle(I18n.getString("fieldPatternDialog.title",
1182:                        "Pattern editor"));
1183:            }
1184:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.