How to modify/add code to the initComponents() met

2019-01-14 12:18发布

How to modify/add code to the initComponents() method in Java on NetBeans? When I try to add any line of code this area seems to be like readonly and it's highlighted in gray! It's for security probably, but I suppose there is a way to disable that.

8条回答
你好瞎i
2楼-- · 2019-01-14 13:03

I discovered by trial and error, that initialization which needs to be done before the user sees the panel should be added as "Pre-Init Code". In my case, I needed to populate a drop down box (called "Choice" in AWT). There seems to be very little detailed documentation available on using Matisse. So, I hope this will help others.

查看更多
三岁会撩人
3楼-- · 2019-01-14 13:04
  1. Close Netbeans
  2. Go to folder path where there is your form file
  3. Backup the 2 files with extensions ".form" and ".java"
  4. Edit the 2 files with extensions ".form" and ".java" in notepad editor. For example if your form name is "myForm" you must have the files "myForm.form" and "myForm.java" in the folder.
  5. The first file ".form" is xml file and the second ".java" is a code java file
  6. Edit carefully your code in both files save changes and open NETBEANS. Thats it!
查看更多
登录 后发表回答