简体   繁体   English

如何使用2D数组和JTable在Java中制作电路板?

[英]How to make a board in Java using 2D arrays and JTable ?

What I have in mind is to make a JTable. 我想到的是制作一个JTable。 The model will use the 2D array's columncount and rowcount to set the JTable's rows and columns. 该模型将使用2D数组的columncount和rowcount设置JTable的行和列。

What I cant figure out is how do I go around making fields for these cells in the table? 我不知道如何在表格中为这些单元格创建字段?

Example fields like - Status(boolean), Image etc. So by having these fields I want to edit the cells when the application is running and show the user the updates. 例如-Status(boolean),Image等字段。因此,通过具有这些字段,我想在应用程序运行时编辑单元格,并向用户显示更新。

I have tried to make a 2D object and add fields in there. 我尝试制作2D对象并在其中添加字段。 But it doesnt seem to work. 但这似乎不起作用。

What would be a good way to build this? 什么是构建此内容的好方法?

I am using swing to build this. 我正在使用秋千来构建它。

This isn't a very specific question so that limits the answer I can give - from what you want to do, I'd suggest 这不是一个非常具体的问题,因此限制了我只能给出的答案-我建议您根据自己的意愿进行操作

  1. Making sure you understand how the Model-View-Controller paradigm works in Swing 确保您了解Model-View-Controller范例在Swing中的工作方式
  2. Looking into the Observer / Observable framework and how it fits in with MVC 研究Observer / Observable框架及其与MVC的配合
  3. Extending some sort of Swing Component to reflect changes in your model. 扩展某种Swing组件以反映模型中的更改。

Once you've covered the above you should find that implementing what you want to do is reasonably trivial, and that you can ask more directed questions that will get better responses. 掌握了以上内容之后,您应该发现实施您想做的事情相当简单,并且您可以提出更有针对性的问题,以获得更好的响应。

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

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