调整JFrame内的JPanel大小 [英] Resizing a JPanel inside a JFrame
问题描述
我是Java新手,开始学习摇摆,并且在JFrame中调整JPanel的大小有问题。我正在学习本教程:
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
因为我最终每个人都在学习不同的布局,现在来到CardLayout。在上文中,有一个JPanel用于状态面板。这也是我想要做的,但是当我将JPanel拖到我的空白JForm上时,它占用了所有空间,我没有看到任何调整大小的句柄,就像我使用.NET面板一样。在属性窗口中更改preferredSize也不会执行任何操作。我在这里想念的是什么?我觉得这是一个完整的菜鸟问这样一个基本的问题,但我真的找不到任何方法来调整这个东西......: - |
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.. :-|
编辑:
我忘了提及;我正在使用NetBeans IDE
I forgot to mention; I am using NetBeans IDE
推荐答案
您无法调整 JComponent
的大小因为你选择 CardLayout
。 CardLayout
可以保存/管理共享相同显示空间的一个或多个组件。
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.
您需要阅读的内容文档和良好的教程。
这篇关于调整JFrame内的JPanel大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!