Problem: In a Java swing desktop application I try to bind a remote mySQL database table to a JTable. NetBeans takes care of all the GUI and persistence part. I built a JFrame form that has a JTable bound to a mySQL table. The query is dynamic and depends on the user’s selection, that actually becomes the WHERE clause. I spent a day trying to include a WHERE clause in the query. After a heavy internet search I figured it out, but when I set the frame to visible the new data is not shown. The JTable repaint() method does exactly nothing. I tried messing up with the fire action listeners, but I couldn’t get that to work either. The JTable has no data refresh method. Can anyone of you tell me the way to have my JTable displayed after an sql query is executed in runtime? I am attaching my code.
Continue reading Binding JTable with mySQL data in Java NetBeans →
public List<object> getDataList(){} // It returns a List<object>
}
public class TestClass extends otherclass{
// I can't cast its list here to List<otherclass>. Compile fires an error at:
List</otherclass><otherclass> o = (List</otherclass><otherclass>)getDataList();
}
</otherclass></object></object>