GUI 程序,选项卡窗格问题

发布于 2024-08-08 02:59:47 字数 425 浏览 6 评论 0原文

我正在使用 MVC 创建一个 GUI 程序,它应该如下所示。 替代文本 http://img137.imageshack.us/img137/6422/93381955.jpg< /a>

我创建了一个窗口和面板类。我正在考虑在 Panel 类中创建输入和显示选项卡,然后再创建两个类:InputPanel 和 DisplayPanel。因此,InputPanel 将在“输入”选项卡下包含此图片中的内容,“显示”选项卡也是如此。有更好的方法来设计这个吗?

另外,由于“输入”选项卡中有 3 个部分(名称和句子、犯罪、按钮),我应该创建 3 个面板还是只创建 1 个包含所有这些的面板?

谢谢

I am creating a GUI program using MVC which should look like this..
alt text http://img137.imageshack.us/img137/6422/93381955.jpg

I have created a Window and Panel class. I am thinking of creating the Input and Display tabs in the Panel class and then creating two more classes, InputPanel and DisplayPanel. So the InputPanel will contain the stuff in this picture under the Input tab and same for the Display tab. Is there a better way to design this?

Also, since there are 3 sections in the Input tab (Name and sentence, crime, button), should I create 3 panels or just 1 panel containing all those?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

少女净妖师 2024-08-15 02:59:47

为了回答您有关使用三个面板而不是 1 个面板的具体问题,我建议使用两个面板。很少需要仅仅为了创建单个小部件而创建面板。因此,一个小部件用于名称和句子,一个小部件用于犯罪。

至于“有没有更好的方法来设计这个”的问题?...听起来你正在学习,所以我建议你不要太关注完美的方法来做到这一点。坚持最初的设计,然后在任务完成后问问自己什么有效*什么无效。有了这些信息,您将能够自己决定您所做的设计是否正确。

设计 GUI 代码时通常没有“最佳”——解决问题的方法有很多。您所描述的听起来像是解决问题的完美方法

(*)在这种情况下“有效”意味着,编码容易吗?它能让您实现您想要的布局吗?例如,如果需要重新组织 GUI,它是否会使代码随着时间的推移而变得可维护?

To answer your specific question about using three panels instead of 1, I would suggest two. There's rarely a need to create a panel just to create a single widget. So, one widget for the name and sentence, one for the crime.

As for the question about "is there a better way to design this"?... It sounds like you are learning, so I suggest you don't focus too much on the perfect way to do it. Stick with your original design then after the task is done ask yourself what worked* and what didn't. With that information you'll be able to decide for yourself whether what you did was the right design.

There usually isn't a "best" when designing GUI code -- there are many ways to solve the problem. What you've described sounds like a perfectly good way to attack the problem

(*) "worked" in this context means, was it easy to code? Did it allow you to achieve the layout you desired? Does it make the code maintainable over time if, for example, a requirement comes down to reorganize the GUI?.

猫七 2024-08-15 02:59:47

布莱恩给出了很好的建议,我只想补充一点,人体工程学并不是一门精确的科学,尽管经验对此有所帮助。
标签很好,例如。单独的设置,或在同一面板(例如工具箱)中对不同的工具集(图层、颜色、画笔...)进行分组。
但它们可能并不适合所有工作流程。但我们缺乏有关“显示”选项卡作用的信息。是否应该在表格中列出所有犯罪行为?表格(如果有)不能位于控件下方吗?

正如 Bryan 所暗示的,最好先设计 GUI,然后再测试它,就像真正的用户一样。您觉得工作流程容易理解吗? (让其他人来测试它!)使用感觉是否自然?使用起来快吗?
然后您可以根据这些观察结果调整设计。

Bryan gave good advices, I will just add that ergonomics isn't an exact science, although experience helps there.
Tabs are nice, eg. to separate settings, or group in a same panel (toolbox for example) different sets of tools (layers, colors, brushes...).
But they might not be adapted to all workflows. But we are lacking information about the role of the Display tab. Is it supposed to list all crimes in a table? Can't the table, if any, be below the controls?

As hinted by Bryan, it is better to design the GUI, then to test it, like would do a real user. Do you find the workflow easy to understand? (make somebody else to test it!) Does the usage feels natural? Is it fast to use?
Then you can adjust the design in light of these observations.

执妄 2024-08-15 02:59:47

您将 InputPanel 和 DisplayPanel 创建为单独的类是正确的。

至于进一步拆分这些面板?是的,你应该进一步将它们分开,但不要分成单独的类。您应该在 InputPanel 和 DisplayPanel 内部添加 jPanel,并将这些控件分组到这些内部 jPanel 中。

如果您希望我澄清我的意思,请告诉我。

You were right to create InputPanel and DisplayPanel as seperate classes.

As for further splitting those panels? Yes you should further split them up, but not into separate classes. You should add jPanels inside of your InputPanel, and DisplayPanel, and group the controls within those internal jPanels.

Please let me know if you would like me to clarify what I mean.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文