JFrame inside another JFrame(另一个 JFrame 中的 JFrame)
问题描述
我有一盘棋.我写了3节课.第一个如果是游戏.(棋盘、棋子等)另一个是菜单.(新建、打开、设置时间等按钮)
I have a game of chess. I have written 3 classes. 1st if for game. (chessboard, pieces, and so on) And another one is for menu. (buttons like new, open, set time)
他们都使用 JFrame.
Both of them use JFrame.
我想把上面提到的两个类都放到第三类.例如,游戏窗口在左侧,菜单在右侧.第三个类也将通过 JFrame 显示整个应用程序.
I would like to put both classes mentioned above into the 3rd class. For example the Game window would be on the left, and the menu on the right. The third class would also show the whole app by JFrame.
怎么做?
推荐答案
你不能把一个 JFrame 放在另一个里面.您在这里有几个设计选择.您可以将 JFrames 更改为 JPanels.这可能是最简单的改变.另一方面,您可以考虑改用 内部框架.
You can't put one JFrame inside another. You have a couple of design choices here. You can change your JFrames to JPanels. This is probably the easiest change. On the other hand, you can look at using Internal Frames instead.
这篇关于另一个 JFrame 中的 JFrame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:另一个 JFrame 中的 JFrame
基础教程推荐
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
