import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileNotFoundException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
/**
*
* @author vitor
*/
public class TelaCrudView extends JFrame implements ActionListener {
JLabel lbTx = new JLabel("LIXO na rua? Reclame aqui!");
JLabel lbIDRe = new JLabel("ID Reclamação");
JTextField tfIDRe = new JTextField();
JLabel lbLc = new JLabel("Local");
JTextField tfLc = new JTextField();
JLabel lbDt = new JLabel("Data");
JTextField tfDt = new JTextField();
JLabel lbAt = new JLabel("Autor");
JTextField tfAt = new JTextField();
public JTextField getTfRe() {
return tfIDRe;
}
public void setTfRe(JTextField tfRe) {
this.tfIDRe = tfRe;
}
public JTextField getTfLc() {
return tfLc;
}
public void setTfLc(JTextField tfLc) {
this.tfLc = tfLc;
}
public JTextField getTfDt() {
return tfDt;
}
public void setTfDt(JTextField tfDt) {
this.tfDt = tfDt;
}
public JTextField getTfAt() {
return tfAt;
}
public void setTfAt(JTextField tfAt) {
this.tfAt = tfAt;
}
JButton btCrt = new JButton("Create");
JButton btRed = new JButton("Read");
JButton btUpd = new JButton("Update");
JButton btDel = new JButton("Delete");
JLabel lbTx1 = new JLabel("Ordenação dos dados, Por:");
JButton btIns = new JButton("Insetion");
JButton btSel = new JButton("Selection");
JButton btCan = new JButton("Cancel");
public TelaCrudView() {
this.setLayout(null);
this.setBounds(100, 50, 480, 380);
getContentPane().setBackground(new Color(150,150,150));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
lbTx.setBounds(150,20,230,25);
lbIDRe.setBounds(50, 60, 120, 25);
tfIDRe.setBounds(150, 60, 275, 25);
lbLc.setBounds(50, 90, 120, 25);
tfLc.setBounds(150, 90, 275, 25);
lbDt.setBounds(50, 120, 120, 25);
tfDt.setBounds(150, 120, 275, 25);
lbAt.setBounds(50, 150, 120, 25);
tfAt.setBounds(150, 150, 275, 25);
btCrt.setBounds(50, 190, 90, 25);
btRed.setBounds(145, 190, 90, 25);
btUpd.setBounds(240, 190, 90, 25);
btDel.setBounds(335, 190, 90, 25);
lbTx1.setBounds(50,220,180,25);
btIns.setBounds(240,220,90,25);
btSel.setBounds(335,220,90,25);
btCan.setBounds(50, 250, 90, 25);
this.add(lbTx);
this.add(lbIDRe);
this.add(tfIDRe);
this.add(lbLc);
this.add(tfLc);
this.add(lbDt);
this.add(tfDt);
this.add(lbAt);
this.add(tfAt);
this.add(btCrt);
this.add(btRed);
this.add(btUpd);
this.add(btDel);
this.add(lbTx1);
this.add(btIns);
this.add(btSel);
this.add(btCan);
btCrt.addActionListener(this);
btRed.addActionListener(this);
btUpd.addActionListener(this);
btDel.addActionListener(this);
btIns.addActionListener(this);
btSel.addActionListener(this);
btCan.addActionListener(this);
this.setVisible(true);
}
public void actionPerformed(ActionEvent arg0) {
TelaCrud tc = new TelaCrud();
Object obj = arg0.getSource();
if (obj.equals(btCrt)) {
try {
tc.Create();
} catch (FileNotFoundException ex) {
Logger.getLogger(TelaCrudView.class.getName()).log(Level.SEVERE, null, ex);
}
} else if (obj.equals(btCan)) {
tc.Cancel();
}