开发者

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜