I have started work on JFrame
in Netbeans. Actually, I do not have knowledge that Why this init()
Function/Method is use in JFrame
? What is the purpose of it? Please Explain me about it.
Thanks,
Assuming you're using the Netbeans GUI Builder tool, I think the method you are referring to is the initComponents();
method call that you see in your constructor.
public class NewJFrame extends javax.swing.JFrame {
public NewJFrame() {
initComponents();
}
}
If you look below the constructor you will see
If you look closely, you will see a +
next to line 31. You can expand that code region by pressing the +
. When you do, you will see the auto-generated initComponents()
method that is called in your constructor.
If you look through the method, you will see that's where all of your components are initialized, and the laying out of the components is done.
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.