Bug 1294 : "class fFrame extends Frame {" it works in first run but later doesn't ..
Last modified: 2009-11-29 08:40




Status:
RESOLVED
Resolution:
DUPLICATE of bug 1199
Priority:
P2
Severity:
normal

 

Reporter:
none
Assigned To:
fry

Attachment Type Created Size Actions
nonworking pde file text/plain 2009-07-24 07:19 970 bytes
working pde file text/plain 2009-07-24 07:20 973 bytes

Description:   Opened: 2009-07-24 07:12
processing version: 1.05
os: vista sp2
tranger errors during compile time

the problem appeared when I try to extend the Frame class:
difference: [ fFrame , fframe ]
fFrame, gFrame doesnt work.
fframe works.
only the second letter of fFrame or gFrame has to be changed to lowercase to
make it run.
error message:
"The nested type fFrame cannot hide an enclosing type."
error:
it runs before save and load but after load the same code into the editor doesn't run
and shows the error message. The nonworking code is just below. working code is at
bottom.
-------------------------------------------------------
nonworking code:
-------------------------------------------------------
fFrame f;

void setup() {
f=new fFrame();
}

void loop() {

}

class fFrame extends Frame {
Button button1 = new Button();

public fFrame() {
button1.setVisible(true);
button1.setLabel("close");
button1.setLocation(new Point(80, 50));
button1.setSize(new Dimension(130, 20));
setLocation(new Point(0, 0));
setLayout(null);
setTitle("windowtitle");
add(button1);

setSize(new Dimension(300, 100));
setVisible(true);

button1.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
button1MouseClicked(e);
}
});

addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
thisWindowClosing(e);
}
});
}

void thisWindowClosing(WindowEvent e) {
cleanUp();
}

void button1MouseClicked(MouseEvent e) {
cleanUp();
}

public void cleanUp() {
setVisible(false);
dispose();
}
}
-------------------------------------------------------
working code:
-------------------------------------------------------
class fframe extends Frame {
Button button1 = new Button();

public fframe() {
button1.setVisible(true);
button1.setLabel("close");
button1.setLocation(new Point(80, 50));
button1.setSize(new Dimension(130, 20));
setLocation(new Point(0, 0));
setLayout(null);
setTitle("windowtitle");
add(button1);

setSize(new Dimension(300, 100));
setVisible(true);

button1.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
button1MouseClicked(e);
}
});

addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
thisWindowClosing(e);
}
});
}

void thisWindowClosing(WindowEvent e) {
cleanUp();
}

void button1MouseClicked(MouseEvent e) {
cleanUp();
}

public void cleanUp() {
setVisible(false);
dispose();
}
}
fframe f;

void setup() {
f=new fframe();
}

void loop() {

}
Additional Comment #1 From none 2009-07-24 07:19
edit]
nonworking pde file

this file doesnt work after load into the editor. if you change class extends
part manualy from fFrame to fframe and run it works.
andif you change it back again from fframe to fFrame it works only to until
next load. mean when you save and load it doesn't work
Additional Comment #2 From none 2009-07-24 07:20
edit]
working pde file

just works
Additional Comment #3 From none 2009-07-24 07:39
the reason of the problem:
if the pde filename and class extender name is the same problem happenings
otherwise just works.

all night i didn't see it but 10 mins after post i saw the reason :)
Additional Comment #4 From fry 2009-11-29 08:40


*** This bug has been marked as a duplicate of 1199 ***