public BillingDialog( String title, boolean visible, boolean undecorate, boolean resizeable, Dimension dim, final String id) { super(title, visible, undecorate, resizeable, dim); RemovablePanel contenPane = new RemovablePanel(this); Color BackGround = Color.GRAY; contenPane.setBackground(Color.getHSBColor(20, 12, 21)); this.setContentPane(contenPane); setLocationRelativeTo(null); setLayout(null); CustomLabel titleLabel = new CustomLabel( title, Color.BLACK, Configure.DEFAULT_RIGHT_PANEL_COLOR, CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 15), new Point(20, 10), new Dimension(360, 40), true, SwingConstants.LEFT, SwingConstants.CENTER, contenPane); final CustomButton ok = new CustomButton( "Yes", Color.WHITE, CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 14), false, false, Color.GRAY, true, new Point(20, 50), new Dimension((dim.width - 50) / 2, 30), contenPane); ok.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { // Bills.deleteBill(id); } catch (SQLException ex) { Logger.getLogger(BillingDialog.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(BillingDialog.class.getName()).log(Level.SEVERE, null, ex); } BillingDialog.this.dispose(); } }); final CustomButton cancel = new CustomButton( "No", Color.WHITE, CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 14), false, false, Color.LIGHT_GRAY, true, new Point(20 + 10 + (dim.width - 50) / 2, 50), new Dimension((dim.width - 50) / 2, 30), contenPane); cancel.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { BillingDialog.this.dispose(); } }); }
public CustomerEdit( String title, boolean visible, boolean undecorate, boolean resizeable, Dimension dimension, final String id) throws SQLException, ClassNotFoundException { super(title, visible, undecorate, resizeable, dimension); setUndecorated(true); RemovablePanel contenPane = new RemovablePanel(this); Color BackGround = Color.getHSBColor(20, 12, 21); contenPane.setBackground(BackGround); this.setContentPane(contenPane); setLayout(null); CustomLabel titleLabel = new CustomLabel( "Edit customer", Color.BLACK, Configure.DEFAULT_RIGHT_PANEL_COLOR, CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 24), new Point(20, 17), new Dimension(360, 40), true, SwingConstants.LEFT, SwingConstants.CENTER, contenPane); Dimension dim = dimension; final HintTextField name = new HintTextField( " Name", CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 13), new Point(20, 70), new Dimension(dim.width - 40, 30), contenPane, false); final HintTextField type = new HintTextField( " Type", CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 13), new Point(20, 110), new Dimension(dim.width - 40, 30), contenPane, false); final HintTextField relationShip = new HintTextField( " Relationship", CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 13), new Point(20, 150), new Dimension(dim.width - 40, 30), contenPane, false); final HintTextField phone = new HintTextField( " Phone", CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 13), new Point(20, 190), new Dimension((dim.width - 40) / 2 - 5, 30), contenPane, false); final HintTextField fax = new HintTextField( " Fax", CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 13), new Point(205, 190), new Dimension((dim.width - 40) / 2 - 5, 30), contenPane, false); final HintTextField email = new HintTextField( " Email", CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 13), new Point(20, 230), new Dimension((dim.width - 40) / 2 - 5, 30), contenPane, false); final HintTextField address = new HintTextField( " Address", CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 13), new Point(205, 230), new Dimension((dim.width - 40) / 2 - 5, 30), contenPane, false); final CustomButton ok = new CustomButton( "Save", Color.WHITE, CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 14), false, false, Color.GRAY, true, new Point(20, 280), new Dimension((dim.width - 50) / 2, 30), contenPane); Customers custemp = Customers.viewCustomer(id); name.setText(custemp.getCustomerName()); type.setText(custemp.getCustomerType()); relationShip.setText(custemp.getCustomerRelationship()); phone.setText(custemp.getCustomerPhone()); fax.setText(custemp.getCustomerFax()); email.setText(custemp.getCustomerEmail()); address.setText(custemp.getCustomerAddress()); System.out.println( name.getText().toString() + " " + phone.getText().toString() + "kfsjdhfdskjfh"); ok.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { String namex = name.getText().toString(); String typex = type.getText().toString(); String relx = relationShip.getText().toString(); String phonex = phone.getText().toString(); String faxx = fax.getText().toString(); String emailx = email.getText().toString(); String addressx = address.getText().toString(); try { Customers.editCustomer(namex, typex, phonex, faxx, emailx, addressx, relx, id); } catch (SQLException ex) { Logger.getLogger(CustomerEdit.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(CustomerEdit.class.getName()).log(Level.SEVERE, null, ex); } CustomerEdit.this.dispose(); } }); final CustomButton cancel = new CustomButton( "Cancel", Color.WHITE, CustomFont.getFont(Configure.DEFAULT_FONT, Font.PLAIN, 14), false, false, Color.LIGHT_GRAY, true, new Point(20 + 10 + (dim.width - 50) / 2, 280), new Dimension((dim.width - 50) / 2, 30), contenPane); cancel.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { CustomerEdit.this.dispose(); } }); }