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
    
    }
    
  • 相关阅读:
    java第二次作业 数组和String类
    java第一次作业
    选择
    latex math
    sum的写法
    qt 4.8.5 vs 2012编译
    物联网笔记四:物联网网络及协议
    物联网学习笔记三:物联网网关协议比较:MQTT 和 Modbus
    物联网学习笔记二:物联网网关
    物联网学习笔记一:物联网入门的必备 7 大概念和技能
  • 原文地址:https://www.cnblogs.com/liuyuanyuanGOGO/p/3070442.html
Copyright © 2011-2022 走看看