简体   繁体   English

如何在Eclipse中使用Windowbuilder填充JTable? (请参见GUI的屏幕截图)

[英]How to populate JTable using Windowbuilder in Eclipse? (See screenshots of the GUI)

Window builder noob here, I'm trying for the first time to create a GUI for a simple program. 这里的Window builder noob,我是第一次尝试为简单程序创建GUI。 I want to have a table on display and some slots that the user will be able to enter the data, then press a button and have them added into the table bellow. 我想显示一个表格,并让用户可以输入数据的某些插槽,然后按一个按钮,将其添加到表格中。 You can take a look at the GUI layout here . 您可以在此处查看GUI布局。

As of now I have no clear strategy of how I'm going to exactly populate the table through the slots above, if someone were to give me some guidance it would be greatly appreciated! 到目前为止,对于如何通过上面的插槽准确填充表格,我还没有明确的策略,如果有人给我一些指导,将不胜感激!

  1. Add an ActionListener to your button. 将ActionListener添加到您的按钮。
  2. In the ActionListener you will need to use the addRow(...) method of the DefaultTableModel to update the table. 在ActionListener中,您将需要使用DefaultTableModeladdRow(...)方法来更新表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM