如何在同一框架上添加可编辑的 JComboBox 和按钮..?
我创建了一个包含 5 列的 JTable。我希望第六列将所有单元格作为 JComboBox,用户可以从中选择他的选择,并且更改将附加到数据库中,为此我需要一个按钮,在其上我可以触发该按钮查询我的数据库。所以请让我知道如何在 JFrame 上添加 JComboBox 和 Button...??我对 Swings 很陌生,所以请让我知道如何完成此操作,对此的详细解释将非常感激......!提前致谢..!!!
I have created a JTable with 5 columns in it .I want the sixth column to have all cells as JComboBox from where an user can select his choice and the change will get appended in databasefor which i need a button on whose action i can fire the query to my database. So please please let me know how to add JComboBox and ButTon on JFrame...?? I am very new to Swings so do let me know how to get this donea detailed explanation about the same will be very thankful...!!! Thanks in advance..!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如何在
JFrame
上添加JComboBox
和JButton
相当简单。我无法将这个问题与表格中问题的第一部分联系起来。但对于我确实理解的部分,您可以使用类似的代码说明如何添加组合框和按钮。请注意,我选择了非常简单的
BorderLayout
。其他布局当然也是可能的,但这完全取决于布局的要求。How to add
JComboBox
andJButton
on aJFrame
is rather trivial. Linking this question to the first part of your question with the table is something I did not manage. But for the part I did understand, you can have something likeThe code illustrates how to add a combobox and a button. Note that I opted for the very simple
BorderLayout
. Other layouts are certainly possible, but it all depends on the requirements of your layout.