简体   繁体   English

Swing JList调整边界大小

[英]Swing JList resize bounds

I have this JList on my JFrom that keeps expanding both horizontally and vertically as i re-size the JForm. 我在JFrom上有这个JList,当我重新调整JForm的大小时,它会在水平和垂直方向上不断扩展。

Netbeans Editor gives you and option to select if some component is Horizontaly / Verticaly re-sizable how can i do that by hand in code. Netbeans编辑器为您提供了选项,可以选择是否某些组件是Horizo​​ntaly / Verticaly可调整大小如何在代码中手动完成。

What worked for me is: 对我有用的是:

JScrollList list = new JScrollList(new JList);
list.setMinimumSize(new Dimension(200, 600));
list.setMaximumSize(new Dimension(200, 35700));

If you want to know how Netbeans GUI Editor does it open a new JFrame add the component set its size bounds then look up the source of the class. 如果你想知道Netbeans GUI Editor是如何做的,那就打开一个新的JFrame,添加组件集的大小边界然后查找类的源代码。

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

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