why this code is not working?,
error: non-static variable jTextField1 cannot be referenced from a static context
try{
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/sample", "", "");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT name FROM testtable");
while (rs.next()){
String n = rs.getString("name");
jTextField1.setText(n);
}
stmt.close();
con.close();
}catch(Exception e){