eclipse 如何通过windowbuilder用JScrollPane包围JTable?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3734857/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to surround JTable with JScrollPane through windowbuilder?
提问by VextoR
In Eclipse Jigloo plugin you can right click on JTable and choose "surrond with JScrollPane".
在 Eclipse Jigloo 插件中,您可以右键单击 JTable 并选择“surrond with JScrollPane”。
But in windowbuilder pro plugin I can't find a way to make JTable with JScrollPane
但是在windowbuilder pro插件中我找不到用JScrollPane制作JTable的方法
回答by Eugene Ryzhikov
Add scroll pane to you gui. Then drag and drop the table onto the scroll pane. During the drag over scroll pane window builder will highlight it's areas- make sure you drop onto central one.
将滚动窗格添加到您的 gui。然后将表格拖放到滚动窗格上。在拖动滚动窗格期间,窗口构建器将突出显示它的区域 - 确保您放到中央区域。
回答by Brian Oliver
Alteratively the following also works nicely;
或者,以下也可以很好地工作;
- Add a JTable
- Right click on the JTable in the tree view
- Select: Surround With > JScrollPane
- 添加 JTable
- 在树视图中右键单击 JTable
- 选择:环绕 > JScrollPane
回答by Lam Chau
Another option would be to use NetBeans to do some of your Swing layout.
另一种选择是使用 NetBeans 来完成一些 Swing 布局。
I've had limited experience with WindowBuilder, but I use NetBeans for designing prototypes and find it much easier for creating UIs. The resulting code generated from NetBeans will also be viewable using WindowBuilder.
我使用 WindowBuilder 的经验有限,但我使用 NetBeans 来设计原型并发现它更容易创建 UI。使用 WindowBuilder 也可以查看从 NetBeans 生成的结果代码。
回答by karim
I am using WindowBuilder 1.7.0 and Swing designer 1.7.0 in Eclipse in Mac. At first I was finding similar menu like Jigloo which I did not find. My Jigloo always crash in Mac and show license message, so I discarded it :) Later with some playing, I found how to do it in WindowBuilder, specially if you have already designed the JTable/JTextArea/JTree and do not want to delete it. After that you need to put them scrollable. You can use the tree view on the left. Normally you cannot drag a component into the scroll view. However add the scroll view in the frame. Set proper layout to the component where you want to put the scroll view. Usually its BorderLayout, may in a JPanel. Drag the JScrollView into target area. Use the tree view for all these actions. Then finally drag the JTree/JTable into the JScrollPane in the frame design view. To my experience this works better. Play with the Layouting of the parent components.
我在 Mac 的 Eclipse 中使用 WindowBuilder 1.7.0 和 Swing Designer 1.7.0。起初我找到了类似 Jigloo 的菜单,但我没有找到。我的 Jigloo 在 Mac 上总是崩溃并显示许可信息,所以我放弃了它:) 后来玩了一些,我找到了如何在 WindowBuilder 中做到这一点,特别是如果您已经设计了 JTable/JTextArea/JTree 并且不想删除它. 之后,您需要将它们设置为可滚动。您可以使用左侧的树视图。通常您不能将组件拖到滚动视图中。但是在框架中添加滚动视图。为要放置滚动视图的组件设置适当的布局。通常它的BorderLayout,可能在一个JPanel中。将 JScrollView 拖入目标区域。将树视图用于所有这些操作。然后最后将 JTree/JTable 拖入框架设计视图中的 JScrollPane。根据我的经验,这效果更好。玩转父组件的布局。