1 package org.netbeans.modules.form.layoutdesign; 2 3 import java.util.Calendar ; 4 import java.text.DateFormat ; 5 import java.text.NumberFormat ; 6 import java.text.SimpleDateFormat ; 7 import javax.swing.JTextField ; 8 import javax.swing.JOptionPane ; 9 10 public class ALT_Bug69497 extends javax.swing.JFrame { 11 12 13 public ALT_Bug69497() { 14 initComponents(); 15 } 16 17 22 private void initComponents() { 24 myJPanel = new javax.swing.JPanel (); 25 jLabel1 = new javax.swing.JLabel (); 26 purchaseDateField = new javax.swing.JTextField (); 27 jLabel3 = new javax.swing.JLabel (); 28 purchasePriceField = new javax.swing.JTextField (); 29 jLabel5 = new javax.swing.JLabel (); 30 maturityDateField = new javax.swing.JTextField (); 31 jLabel2 = new javax.swing.JLabel (); 32 couponField = new javax.swing.JTextField (); 33 jLabel7 = new javax.swing.JLabel (); 34 callDateField = new javax.swing.JTextField (); 35 jLabel6 = new javax.swing.JLabel (); 36 callPriceField = new javax.swing.JTextField (); 37 38 setTitle("Bond Calculator (alpha)"); 39 addWindowListener(new java.awt.event.WindowAdapter () { 40 public void windowClosing(java.awt.event.WindowEvent evt) { 41 exitForm(evt); 42 } 43 }); 44 45 jLabel1.setText("Purchase Date"); 46 jLabel1.setToolTipText("Purchase date of bond (MM/DD/YY)"); 47 48 purchaseDateField.setColumns(10); 49 50 jLabel3.setText("Purchase Price"); 51 jLabel3.setToolTipText("Purchase price of bond (e.g., 100)"); 52 53 purchasePriceField.setColumns(10); 54 55 jLabel5.setText("Maturity Date"); 56 jLabel5.setToolTipText("Maturity date of bond (MM/DD/YY)"); 57 58 maturityDateField.setColumns(10); 59 60 jLabel2.setText("Coupon"); 61 jLabel2.setToolTipText("Annual interest (e.g., 6.5)"); 62 63 couponField.setColumns(10); 64 65 jLabel7.setText("Call Date"); 66 jLabel7.setToolTipText("Call date of bond (MM/DD/YY)"); 67 68 callDateField.setColumns(10); 69 70 jLabel6.setText("Call Price"); 71 jLabel6.setToolTipText("Call price (e.g., 100)"); 72 73 callPriceField.setColumns(10); 74 75 org.jdesktop.layout.GroupLayout myJPanelLayout = new org.jdesktop.layout.GroupLayout(myJPanel); 76 myJPanel.setLayout(myJPanelLayout); 77 myJPanelLayout.setHorizontalGroup( 78 myJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 79 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 80 .add(myJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 81 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 82 .addContainerGap() 83 .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 84 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 85 .addContainerGap() 86 .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 87 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 88 .addContainerGap() 89 .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 90, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 90 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 91 .addContainerGap() 92 .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 54, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 93 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 94 .addContainerGap() 95 .add(jLabel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 62, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 96 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 97 .addContainerGap() 98 .add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 62, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) 99 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 100 .add(myJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 101 .add(callPriceField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 102 .add(callDateField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 103 .add(maturityDateField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 104 .add(couponField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 105 .add(purchasePriceField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 106 .add(purchaseDateField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 107 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 108 ); 109 myJPanelLayout.setVerticalGroup( 110 myJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 111 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 112 .add(myJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 113 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 114 .add(17, 17, 17) 115 .add(myJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) 116 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 117 .add(2, 2, 2) 118 .add(purchaseDateField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 119 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 120 .add(purchasePriceField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 121 .add(36, 36, 36)) 122 .add(org.jdesktop.layout.GroupLayout.TRAILING, myJPanelLayout.createSequentialGroup() 123 .add(jLabel3) 124 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 125 .add(jLabel5) 126 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 127 .add(myJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 128 .add(maturityDateField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 129 .add(jLabel2)) 130 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))) 131 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 132 .addContainerGap() 133 .add(jLabel1))) 134 .add(myJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 135 .add(org.jdesktop.layout.GroupLayout.LEADING, myJPanelLayout.createSequentialGroup() 136 .add(couponField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 137 .add(9, 9, 9) 138 .add(callDateField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 139 .add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 140 .add(2, 2, 2) 141 .add(myJPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 142 .add(callPriceField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 143 .add(jLabel6)) 144 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 145 ); 146 getContentPane().add(myJPanel, java.awt.BorderLayout.NORTH); 147 148 pack(); 149 } 151 152 private void exitForm(java.awt.event.WindowEvent evt) { System.exit(0); 154 } 156 159 public static void main(String args[]) { 160 java.awt.EventQueue.invokeLater(new Runnable () { 161 public void run() { 162 appFrame = new ALT_Bug69497(); 163 appFrame.setVisible(true); 164 } 165 }); 166 } 167 168 private static javax.swing.JFrame appFrame; 169 170 private javax.swing.JTextField callDateField; 172 private javax.swing.JTextField callPriceField; 173 private javax.swing.JTextField couponField; 174 private javax.swing.JLabel jLabel1; 175 private javax.swing.JLabel jLabel2; 176 private javax.swing.JLabel jLabel3; 177 private javax.swing.JLabel jLabel5; 178 private javax.swing.JLabel jLabel6; 179 private javax.swing.JLabel jLabel7; 180 private javax.swing.JTextField maturityDateField; 181 private javax.swing.JPanel myJPanel; 182 private javax.swing.JTextField purchaseDateField; 183 private javax.swing.JTextField purchasePriceField; 184 186 } 187 | Popular Tags |