Resizing a JPanel inside a JFrame

主宰稳场 提交于 2019-12-31 01:40:05

问题


I am new to Java, started learning swing and have a problem with resizing a JPanel inside a JFrame. I am following this tutorial:

http://vincentramdhanie.blogspot.com/2009/11/cardlayout-with-netbeans.html

because ultimately I am learning each of the different layouts and have come to the CardLayout now. In the above, there is a JPanel being used for a status panel. That is what I want to do as well, but when I drag a JPanel onto my blank JForm it takes up all the space and I don't see any resizing handles for it like I would if I were using a .NET panel. Changing preferredSize in the properties window also does nothing. What am I missing here? I feel like a complete noob for asking such a basic question but I really can't find any way to resize this thing.. :-|

EDIT:

I forgot to mention; I am using NetBeans IDE


回答1:


You can't resize the JComponent because you've select CardLayout. The CardLayout can holds/manages one or more components that share the same display space.

What you need to read documentation and good tutorials.



来源:https://stackoverflow.com/questions/12328627/resizing-a-jpanel-inside-a-jframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!