简体   繁体   中英

Swing JList resize bounds

I have this JList on my JFrom that keeps expanding both horizontally and vertically as i re-size the 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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