简体   繁体   English

在Window Builder for Eclipse的编辑视图中,如何创建足够大的JPanel?

[英]In the edit view of Window Builder for Eclipse, how to create a big enough JPanel?

I'm trying to build a java GUI with SWING in Window Builder using Eclipse IDE. 我正在尝试使用Eclipse IDE在Window Builder中使用SWING构建Java GUI。 What I want to do is to create a long form. 我要做的是创建一个长格式。 I create a JPanel, I can adjust the size of this JPanel in the editing area by dragging the boder of the panel as normal, But the problem I found is that no matter how far I drag down the bottom border, the heigth of this JPanel won't go any further. 我创建了一个JPanel,可以通过正常拖动面板的边框来在编辑区域中调整此JPanel的大小,但是我发现的问题是,无论我将底部边框的高度拖到底部边框多远不会再走了。

I found some answers saying that the edit window of Window Builder won't render any components falling outside of the bounds of the display size. 我发现一些答案说Window Builder的编辑窗口不会渲染超出显示尺寸范围的任何组件。 That means in the edit area of Window Builder in Eclipse, I can only create and see a JPanel whose maximum size equals to my display resolution? 这意味着在Eclipse的Window Builder的编辑区域中,我只能创建并看到一个最大尺寸等于显示分辨率的JPanel吗?

That's not very convenient especially when you want to edit GUI in a WYSIWYG way. 这不是很方便,尤其是当您要以所见即所得的方式编辑GUI时。 Then what can we do when people really need a big GUI? 当人们真的需要一个大的GUI时,我们该怎么办?

Typically in cases like this we use a JScrollPane with the JPanel inside. 通常,在这种情况下,我们使用内部带有JPanelJScrollPane You can then make those panels as long/wide as you want, and it will auto generate scroll bars as required. 然后,您可以将这些面板设为所需的长度/宽度,然后它将根据需要自动生成滚动条。 The IDE will let you scroll these bars in the WYSIWYG editor so you can place controls further down. IDE将允许您在WYSIWYG编辑器中滚动这些栏,以便可以将控件进一步向下放置。

See the official documentation on how to properly implement them. 请参阅官方文档以了解如何正确实施它们。

您不能创建一个大于屏幕可见区域并能够看到它的JPanel,而要做的是创建一个您想要的大小的JPanel,然后将其放入一个JScrollPane中,该JScrollPane具有滚动条以显示一部分放入的组件(在这种情况下为JPanel)中,如果您使用的是IDE,则可以创建JScrollPanel并确保滚动条的属性未设置为NEVER,可以将其设置为VERTICAL_SCROLLBAR_​​AS_NEEDED以进行水平滚动HORIZONTAL_SCROLLBAR_​​AS_NEEDED进行垂直滚动滚动,然后创建一个JPanel并将其拖动到您之前创建的JScrollPanel内,最后通过将其大小属性更改为所需的大小来调整JPanel的大小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM