private void OKActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_OKActionPerformed String invoice = InvoiceTF.getText().trim(); String description = DescriptionArea.getText(); String other = ""; int amount = 0; if (invoice.trim().equals("")) { JOptionPane.showMessageDialog( null, "Please insert the invoice text field! ", "Warning", JOptionPane.WARNING_MESSAGE); InvoiceTF.requestFocusInWindow(); return; } try { amount = Integer.parseInt(AmountTF.getText()); } catch (NumberFormatException nfe) { JOptionPane.showMessageDialog( null, "Please insert the amount text field " + "with number! ", "Warning", JOptionPane.WARNING_MESSAGE); AmountTF.requestFocusInWindow(); return; } // edit other income transaction // other income transaction other = ""; boolean result = tr.OthersIncomeTransaction( invoice, new java.sql.Date(OtherDateChooser.getDate().getTime()), amount, description); if (transactionsEP != null && result) { HTMLEditorManipulation htmlem = new HTMLEditorManipulation(transactionsEP, conn); htmlem.HTMLIncomeDialog(InvoiceTF.getText().trim()); } dispose(); } // GEN-LAST:event_OKActionPerformed
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ private void initComponents() { // GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); TopPanel = new javax.swing.JPanel(); TopRightPanel = new javax.swing.JPanel(); OtherDateChooser = new com.toedter.calendar.JDateChooser(); TopLeftPanel = new javax.swing.JPanel(); InvoiceLB = new javax.swing.JLabel(); InvoiceTF = new javax.swing.JTextField(); BottomPanel = new javax.swing.JPanel(); Cancel = new javax.swing.JButton(); OK = new javax.swing.JButton(); DummyLeftLabel = new javax.swing.JLabel(); RightDummyLabel = new javax.swing.JLabel(); TaxPanel = new javax.swing.JPanel(); AmountLabel = new javax.swing.JLabel(); AmountTF = new javax.swing.JTextField(); DescriptionLabel = new javax.swing.JLabel(); DescriptionArea = new javax.swing.JTextArea(); IncomeTransactionLabel = new javax.swing.JLabel(); jMenu1.setText("Menu"); jMenuBar1.add(jMenu1); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Income Dialog"); TopPanel.setLayout(new java.awt.BorderLayout()); TopRightPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 10)); OtherDateChooser.setPreferredSize(new java.awt.Dimension(151, 20)); TopRightPanel.add(OtherDateChooser); TopPanel.add(TopRightPanel, java.awt.BorderLayout.EAST); TopLeftPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 10)); InvoiceLB.setText("Invoice : "); TopLeftPanel.add(InvoiceLB); InvoiceTF.setColumns(12); TopLeftPanel.add(InvoiceTF); TopPanel.add(TopLeftPanel, java.awt.BorderLayout.WEST); getContentPane().add(TopPanel, java.awt.BorderLayout.NORTH); BottomPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 10, 10)); Cancel.setText("Cancel"); Cancel.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CancelActionPerformed(evt); } }); BottomPanel.add(Cancel); OK.setText("OK"); OK.setPreferredSize(new java.awt.Dimension(75, 25)); OK.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { OKActionPerformed(evt); } }); BottomPanel.add(OK); getContentPane().add(BottomPanel, java.awt.BorderLayout.SOUTH); DummyLeftLabel.setText(" "); getContentPane().add(DummyLeftLabel, java.awt.BorderLayout.WEST); RightDummyLabel.setText(" "); getContentPane().add(RightDummyLabel, java.awt.BorderLayout.EAST); TaxPanel.setLayout(new java.awt.GridBagLayout()); AmountLabel.setText("Amount of Transactions :"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); TaxPanel.add(AmountLabel, gridBagConstraints); AmountTF.setColumns(24); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); TaxPanel.add(AmountTF, gridBagConstraints); DescriptionLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); DescriptionLabel.setText("Description :"); DescriptionLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10); TaxPanel.add(DescriptionLabel, gridBagConstraints); DescriptionArea.setColumns(24); DescriptionArea.setLineWrap(true); DescriptionArea.setRows(5); DescriptionArea.setWrapStyleWord(true); DescriptionArea.setBorder(new javax.swing.border.EtchedBorder()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.gridheight = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; TaxPanel.add(DescriptionArea, gridBagConstraints); IncomeTransactionLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); IncomeTransactionLabel.setText("Income Transaction"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); TaxPanel.add(IncomeTransactionLabel, gridBagConstraints); getContentPane().add(TaxPanel, java.awt.BorderLayout.CENTER); pack(); } // GEN-END:initComponents