/** Creates new form TaxDialog */ public IncomeTransactionDialog( java.awt.Frame parent, boolean modal, javax.swing.JEditorPane transactionsEP, Connection conn) { super(parent, modal); this.conn = conn; tr = new Transaction(conn); initComponents(); GuiHelper.setOnCenter((Window) this); this.transactionsEP = transactionsEP; // setup the default button getRootPane().setDefaultButton(OK); }
/** Creates new form AddSellerDialog */ public EditItemDialog(java.awt.Frame parent, boolean modal, JTable table, Connection conn) { super(parent, modal); this.conn = conn; initComponents(); GuiHelper.setOnCenter((Window) this); this.table = table; row = table.getSelectedRow(); item_code = (String) table.getModel().getValueAt(row, 0); // set data on dialog text field itemCodeTF.setText(item_code); nameTF.setText((String) table.getModel().getValueAt(row, 2)); categoryTF.setText((String) table.getModel().getValueAt(row, 1)); // just use plain number instead the currency format NumberFormat nf = NumberFormat.getCurrencyInstance(new Locale("id", "id")); try { buyingPriceTF.setText((nf.parse((String) table.getModel().getValueAt(row, 3))).toString()); salePriceTF.setText((nf.parse((String) table.getModel().getValueAt(row, 4))).toString()); } catch (java.text.ParseException pe) { pe.printStackTrace(); } commentTA.setText((String) table.getModel().getValueAt(row, 6)); // if length field is null, then deselect the detail size of checkbox if (((Integer) table.getModel().getValueAt(row, 8)).intValue() == 0) { DetailSizeCheckBoxActionPerformed(null); VolumeTF.setText(((Integer) table.getModel().getValueAt(row, 11)).toString()); } // if length, width, height field are not null, then deselect the volume checkbox else { VolumeCheckBoxActionPerformed(null); LengthTF.setText(((Integer) table.getModel().getValueAt(row, 8)).toString()); WidthTF.setText(((Integer) table.getModel().getValueAt(row, 9)).toString()); HeightTF.setText(((Integer) table.getModel().getValueAt(row, 10)).toString()); VolumeTF.setText(((Integer) table.getModel().getValueAt(row, 11)).toString()); } PrimaryTF.setText((String) table.getModel().getValueAt(row, 12)); MeasurementTF.setText(((Integer) table.getModel().getValueAt(row, 13)).toString()); SecondaryTF.setText((String) table.getModel().getValueAt(row, 14)); SecondaryThirdMeasurementTF.setText( ((Integer) table.getModel().getValueAt(row, 17)).toString()); ThirdTF.setText((String) table.getModel().getValueAt(row, 18)); producerdb = new ProducerDB(conn); producerdb.initializeComboBoxProducer(ProducerCoB); ProducerCoB.setSelectedItem((String) table.getModel().getValueAt(row, 15)); sellerdb = new SellerDB(conn); sellerdb.initializeSellerItem(listModel); sellerdb.initializeSuplierForItem( itemsellerModel, (String) table.getModel().getValueAt(row, 2)); sellerdb.harmonizeSellerItem(listModel, itemsellerModel); st = new InventoryDB(conn); st.initializeComboBox(WarehouseCB, "warehouse"); getRootPane().setDefaultButton(OK); itemindex = st.getItemIndex(item_code); // select warehousecombo box programmatically so quantity and expired date is set up WarehouseCB.setSelectedIndex(0); QuantityTB.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); }