Hi guys well I have two class's 1 class for my methods and another class for my GUI. In my method class I have my update statements for my database and in my GUI class I have obviously my gui and all my buttons that will produce a result when clicked. My problem is that I have set my update statement to work with getText from my GUI class. So how do I go about setting it up in my method class to read the getText from my GUI class?
My code can be seen below:
Method class code:
public static String UPDATE() {
String output = listHeader();
try {
ResultSet res = stmt.executeQuery("UPDATE VIDEOS SET VIDEONAME = '" + v + "' , DIRECTOR = '" + s + "' , RATING = ' "
+ r + "' , PLAYCOUNT = ' " + p + " ' WHERE VIDEOID = '"+ f + "'");
while (res.next()) { // there is a result
output += formatListEntry(res);
}
} catch (Exception e) {
System.out.println(e);
return null;
}
return output;
}
Gui class code
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == writeBtn) {
String f = VIDEOIDS.getText();
String v = VIDEONAMES.getText();
String s = DIRECTORS.getText();
String r = RATINGS.getText();
String p = PLAYCOUNTS.getText();
String key = VIDEOIDS.getText();
String name = VideoData.getName(key);
if (name == null) { // if user input if null the following statement will execute
showMessageDialog(this, "Please Enter Valid Video ID"); // information field will prduce following text
}
else {
// if any field is blank, signal an error
METHODS.UPDATE();
}}}