开发者

adding a jpanel to a jframe

Is it possible to a开发者_运维知识库dd a JPanel to a JFrame? How can it be done?

JFrame frame = new JFrame();
JPanel panel = new JPanel(); 


Sure it's possible - you can do it like this:

frame.setContentPane(panel);

This panel will be the container in which you'll put all the components of your UI(except the menubar).


yes, sure, same way as you would add any component to any container:

frame.add(panel)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜