简体   繁体   中英

Adding components to JPanel

I have a JFrame in which constructor I call initComponents() generated by Netbeans. It initializes the GUI created in Netbean's design editor. After that I create a new JLabel and call content.add(label) where content is a JPanel which is visible. Next I call validate(). The JLabel won't appear. What's wrong?

What LayoutManager are you using?

The default layout manager used by NetBeans is the Freeform layout manager.

It was designed to used by the form editor and was not designed to be used by hand.

It's possible that with the lack of constraints, your label is simply been ignored

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