public void addId() { GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.PAGE_END; nume_util_lbl = new JLabel(admin.getNume()); tip = new JLabel("Administrator"); nume_util_lbl = new JLabel(admin.getNumeUtil()); tip = new JLabel("Administrator"); back = new JButton("Back"); back.setPreferredSize(new Dimension(200, 30)); back.addActionListener(this); JPanel pan = new JPanel(new GridLayout(2, 1, 5, 5)); pan.add(nume_util_lbl); pan.add(tip); c.gridx = 1; c.gridy = 5; this.add(pan, c); c.gridx = 0; pan.setBorder(new EtchedBorder()); this.add(back, c); }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(add)) { Bundle info = getInfoAdmin(); admin.addUtilizator(Centralizator.getInstance(), TipUtilizator.Administrator, info); JOptionPane.showMessageDialog(this, "Administrator adaugat cu succes!"); } else if (e.getSource().equals(back)) { dispose(); Centralizator cen = Centralizator.getInstance(); cen.saveCentralizator(); new AddUtil(admin); } }