how to get data on jlist created through design view on jframe in netbeans?
I am using Netbeans IDE for my project, I have created a jframe
class, and from the design view I put a panel
, on which I have put a jlist
.
I开发者_运维问答 want to get the names of the databases from MySQL dynamically on to this jlist
.
How can I do that?
Your JList
is available as a variable inside your form class - just use, e.g.
jList1.getModel()
....
and do what you want.
But there are database-viewing components for Swing, which will probably be easier than rolling your own database code (remember to close your PreparedStatements
and ResultSets
if you do).
精彩评论