2014-06-14 33 views
0

我有兩個單選按鈕,這是狀態越來越爲它們設置的代碼:我在一個文本編輯器修改的方法來此NetBeans 8.0可以自動更改自動生成的Swing代碼嗎?

jRadioButton6.addMouseListener(new java.awt.event.MouseAdapter() { 
     public void mouseClicked(java.awt.event.MouseEvent evt) { 
      jRadioButton6MouseClicked(evt); 
     } 
    } 

jRadioButton6.addItemListener(new ItemListener() { 

     @Override 
     public void itemStateChanged(ItemEvent e) { 
      jRadioButton6MouseClicked(); 

     } 
    } 

看樣子進行修改的界面觸發這種行爲。

+0

你使用NetBeans改變它或不同的文本編輯器?你是否刷新了Netbeans中的所有內容,以便知道文件已更改,或者重新啓動了/重新編譯了你的代碼? – Philipp

+0

我有我的代碼的備份版本,其中包含修改,我使用超越比較返回到一個可行的版本,或在這種情況下恢復方法。備份版本位於不同的文件夾中,我保存了重新啓動的NedBeans的更改,有時可用於運行代碼,但我一直無法弄清楚導致此問題的原因。 –

+0

它出現修改界面觸發編輯。 –

回答

0

我試圖修改自動生成的代碼。甚至還有的代碼開始的警告:我應該選擇一個JRadioButton和下活動我應該選擇

/** 
    * This method is called from within the constructor to initialize the form. 
    * WARNING: Do NOT modify this code. The content of this method is always 
    * regenerated by the Form Editor. 
    */ 

所以在設計視圖itemStateChanged和設置函數,我想被稱爲這個事件。

我做了一個在左邊和右邊的解決方案進行比較我的錯誤: Compare