zoukankan      html  css  js  c++  java
  • netbeans拖控件做的界面出现“窗体损坏”的解决办法

    问题呈现:netbeans提示窗体损坏,只能以只读方式呈现空间,没法再直接修改控件。

    问题原因:其实就是自动生成initComponent和action方法等的代码里,那部分标记属性设置、方法开始、方法结束的绿色的字体的标记代码缺失造成的。

    解决办法:找原先的文件,对比,把绿色的标记性代码补全即可。

     

    文档中,详细问题表述和解决办法如下(网址 http://wiki.netbeans.org/FormGuardedBlockError):

    FormGuardedBlockError

    Guarded blocks inside form java source file

    What you do in the Form Editor is stored in an XML file with the extension .form with the same name as your class. This XML is used to generate the code that instantiates and initializes your visual components. This code appears in a method called InitComponents(), which appears in a read-only guarded block in the editor (blue background). Also declaration of form component variables are generated into guarded block.


    Close the form inside IDE and check the content of the form java class file inside plain text editor (notepad, vi, ...). Guarded block starts with //GEN-BEGIN:name and ends with //GEN-END:name. Form editor generates java code between these paired tags and if editor is not able to find these tags, form will be opened only in read-only mode.

    public class NewJFrame1 extends javax.swing.JFrame {
    
        public NewJFrame1() {
            initComponents();
        }
    
        ...
    
        // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
        private void initComponents() {
    
            ...
    
        }// </editor-fold>//GEN-END:initComponents
    
    
        ....
    
        // Variables declaration - do not modify//GEN-BEGIN:variables
        private javax.swing.JButton jButton1;
    
        ....
    
        private javax.swing.JButton jButton2;
        // End of variables declaration//GEN-END:variables
    
    }
    
  • 相关阅读:
    springboot 的一般配置
    springmvc 中将MultipartFile转为file,springboot 注入CommonsMultipartResolver
    .OPF文件剖析
    Epub格式的电子书——文件组成
    解决js代码中加入alert()就成功执行,不加就不对的问题!
    java编程之POI读取excel表格的内容
    MyBatis之一对多映射查询sql配置文件。
    springMVC的拦截器
    SpringMvc的上传和下载
    SpringMVC传递数据的流线图
  • 原文地址:https://www.cnblogs.com/liuyuanyuanGOGO/p/3070442.html
Copyright © 2011-2022 走看看