简体   繁体   English

splitPane上的摇摆行为

[英]Swing behavior on splitPane

  JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
             scrollPane , scrollPane2);

I want to do very trivial action and I it doesn't work. 我想执行非常琐碎的操作,但它不起作用。

Whenever I add label to either of scrollPanes - they simply don't display anything. 每当我向任一scrollPanes添加标签时-它们根本不显示任何内容。 I can display tables within panes but these are added through the constructor. 我可以在窗格中显示表,但这些表是通过构造函数添加的。 Pisses a lot. 浮躁很多。

Also if splitPane only allows two components - what if I want to separate window into four parts? 另外,如果splitPane仅允许两个组件-如果我想将窗口分为四个部分怎么办? SplitPane of SplitPane? SplitPane的SplitPane?

Thanks for help, 感谢帮助,

You might compare your implementation to this example that adds a JLabel instance to a JPanel on each side of the JSplitPane . 您可以将实现与本示例进行比较,该示例JLabel实例添加到JSplitPane两侧的JPanel

图片

Although JSplitPane only admits two components, you can add another JSplitPane to either pane in order to subdivide either side in either direction, ad libitum . 虽然JSplitPane只承认两个组件,您可以添加其他JSplitPane ,以细分两侧在任一方向, 自由采食要么窗格。

Don't forget to call updateUI() after you've added your components. 添加组件后,不要忘记调用updateUI() JSplitPane is really only supposed to be used for splitting into two components. JSplitPane实际上仅应用于拆分为两个组件。 If you require more, consider using a TableView . 如果您需要更多,请考虑使用TableView

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

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