I need to have a update button to update a edited textfield and save it to the database. I have created the button but have no idea on how to make it update the edited textfield and update the SQL database automatically. Pls help!!):
This is my code:
private JButton getJButtonUpdate() {
int centralize_width = (screenSize.width/2) - 150;
if (jButton_Update == null) {
jButton_Update = new JButton();
jButton_Update.setText("Update");
jButton_Update.setLocation(new Point(centralize_width, 300));
jButton_Update.setSize(new Dimension(150, 30));
jButton_Update.setHorizontalTextPosition(SwingConstants.CENTER);
jButton_Update.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("Moving on to Existing Panel!");
if(Selected != null) {
JPanel panel = new Case_Details(frame, Analyst_ID, Selected);
frame.getContentPane().removeAll();
frame.getContentPane().add(panel);
frame.getContentPane().validate();
frame.getContentPane().repaint();
}
}
});
}
return jButton_Update;
}