[英]Resizing Components with JFrame
I have a JFrame
that contains two JPanel
containers. 我有一个包含两个
JPanel
容器的JFrame
。 In the below picture one panel is blue, the other contains a JTable
. 在下面的图片中,一个面板为蓝色,另一个面板包含
JTable
。 As can be seen, when I resize the frame, the frame (the blank gray area) expands. 可以看出,当我调整框架的大小时,框架(空白的灰色区域)会扩大。 I would like the table panel to expand to fill this area.
我希望表格面板可以扩展以填充该区域。
IMG http://i61.tinypic.com/2evujdj.png[/IMG] IMG http://i61.tinypic.com/2evujdj.png[/IMG]
What layout managers will accomplish this? 哪些布局经理将完成此任务?
A BorderLayout
with the table in (a scroll pane) in the CENTER
and button panel in the PAGE_START
should do it. 在
CENTER
的表(滚动窗格)和PAGE_START
按钮面板的BorderLayout
应该可以做到这一点。 Thought I'd probably use a JToolBar
(instead of a JPanel
) for the buttons. 以为我可能会为按钮使用
JToolBar
(而不是JPanel
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.