另一个 JFrame 中的 JFrame [英] JFrame inside another JFrame

查看:35
本文介绍了另一个 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆