MichalB
MichalB

Reputation: 3341

How to regenerate my corrupted GUI form?

Hej all,

Yesterday before finishing my work I build up my project in NetBeans and saved it. Today when I got up and open project, I got a warning like this: http://imageshack.us/photo/my-images/812/problemez.png/.

What can I do in order to recover my GUI form? now my GUI is just in read-only mode, what is totally useless ...

Thanks!

Michal.

OK I have done it finally. For those of you who would find similar problem: 1. Create new GUI JFrame form in the same project. 2. Copy all the compoments from the previous JFRame form(in read-only mode) into the new one 3. There will be automatically created new code, now correctly. 4. Just copy all your code into the new form code.

Upvotes: 7

Views: 8590

Answers (5)

Ciprian Ciubotariu
Ciprian Ciubotariu

Reputation: 31

Right-click on the Form object in Navigator, and click Reload form.

netbeans-screencapture

Upvotes: 1

OOP
OOP

Reputation: 295

Editing the .java to add the missing NetBeans comments, as suggested by Angelo Fuchs seems to be easier than creating a new frame.

Here is how to "repair" the variable declaration bloc and the generated event methods:

// <editor-fold defaultstate="collapsed" desc=" Variables declaration - do not modify ">
// Variables declaration - do not modify//GEN-BEGIN:variables
private JPanel jPanelChart;
private JSlider jSliderThickness;
// End of variables declaration//GEN-END:variables
//</editor-fold>

and

    private void jSliderThicknessStateChanged(ChangeEvent evt) {//GEN-FIRST:event_jSliderThicknessStateChanged
    stroke = jSliderThickness.getValue() * 0.01f;
    renderer.setSeriesStroke(0, new BasicStroke(stroke));
}//GEN-LAST:event_jSliderThicknessStateChanged

Upvotes: 1

Ahmad R. Nazemi
Ahmad R. Nazemi

Reputation: 805

create new Jframeand in Jframe Navigator of NetBeans copy all component in previous Jframeto new Jframe

Upvotes: 0

MichalB
MichalB

Reputation: 3341

For those of you who would find similar problem:

  1. Create new GUI JFrame form in the same project.
  2. Copy all the components from the previous JFrame form(in read-only mode) into the new one
  3. There will be automatically created new code for new form.
  4. Just copy all your code (your methods) into the new form code.

Upvotes: 10

Angelo Fuchs
Angelo Fuchs

Reputation: 9941

most likely you removed the parts that say 'generated code here'

(the lines look like this:

// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
...
}// </editor-fold>//GEN-END:initComponents

recreate them. And be aware that there are more than just the ones for initComponents.

Upvotes: 4

Related Questions