如何在Java Swing中在分割平面的右侧添加两个组件
我想在右侧添加两个组件,即分割平面右侧的 JTextField
和 JTable
。下面的代码不起作用。我该怎么办?
上面代码的结果:(但是如果我添加组件(表)中JScrollPane
然后它在右侧显示表格
I want to add two components on the right side, i.e. JTextField
and JTable
on right side of the split plane. The below code is not working. What shall I do?
The result of the above code :( but if I add component (table) in the JScrollPane
then it's showing table on right side.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要将 布局管理器 设置为 null。使用适当的布局管理器。我建议使用 BorderLayout。
下面的代码不是完整的解决方案,只是一个帮助您入门的示例。
这是屏幕截图。
Don't set the layout manager to null. Use an appropriate layout manager. I suggest using BorderLayout.
The below code is not a complete solution, just an example to get you started.
Here is a screen capture.