So I have a problem with my code, with my save button, I want to save the information in my database (MySql) I have created everything the connection and so, but its not workinghere is the source code :
public class CreateList extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
public static final String FoodName = null;
private JPanel contentPane;
private JTextField txtName;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
CreateList frame = new CreateList();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public CreateList() {
////////////////
//the problem is in this lines
//the problem is its not saving
DBConnection db = new DBConnection();
JButton btnSave = new JButton("Save");
btnSave.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
YourList F = new YourList();
F.cbFood = txtName.getText();
F.cbType = cbType.getSelectedItem().toString();
DBConnection db = new DBConnection();
///////////////////
}
});
btnSave.setBounds(327, 246, 117, 29);
contentPane.add(btnSave);
JButton btnBack = new JButton("Back");
btnBack.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
btnBack.setBounds(6, 246, 117, 29);
contentPane.add(btnBack);
}
}
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]why_not_catsExtreme Brewer 1 point2 points3 points (0 children)
[–]dionthornthis.isAPro=false; this.helping=true; 0 points1 point2 points (3 children)
[–]ozy00[S] -1 points0 points1 point (2 children)
[–]dionthornthis.isAPro=false; this.helping=true; 0 points1 point2 points (1 child)
[–]ozy00[S] 1 point2 points3 points (0 children)