【发布时间】:2012-05-02 00:35:16
【问题描述】:
好的,现在我有一个包含 JLayeredPane 的 JFrame。所以它现在运行一个游戏 GUI。我想在这个框架的一侧添加按钮,以便我可以通过按钮接收用户的输入。 有什么想法吗?
class mapGUI extends JFrame{
layeredPane = new JLayeredPane();
mapSize = new Dimension(mapColumn * 16 , mapRow * 16);
layeredPane.setPreferredSize(mapSize);
//Adding the layeredPane to the frame.
getContentPane().add(layeredPane);
//Adds the appropriate labels to the panels and adds them to the layeredPane.
addPlayerPos();
addDungeonItems();
addDungeonFloor();
setDefaultCloseOperation(EXIT_ON_CLOSE);
setResizable(false);
pack();
setLocationRelativeTo(null);
setVisible(true);
}
这是我创建 JFrame 并向其中添加 JLayeredPane 的代码部分。
【问题讨论】:
-
抱歉不知道,没有发布SSCCE 的想法也证明了您的问题
-
您想在哪里添加按钮以及您打算如何使用它们?
-
“现在好点了吗?”它不是像@mKorbel建议的那样是SSCCE!
-
我想将它们添加到右侧。我想添加 5 个按钮。