Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi,i hv a problem with this java prog when i compile it says reached end of file while parsing }^. i know tht means i hv left a brace somewhere so when i check the program and pair up braces no . of errors increase can u plz help me compile it???? this is my prog-import java.awt.*;
import java.applet.*;
import java .awt.event.*;
import java.swing.*;
public class popup extends JApplet implements ActionListner
{
JLabel l1;
JPopupmenu pm;
public void poptest()
{
l1=new label("right cclick");
pm=new popupmenu();JMenuitem mblue=new JMenuitem("BLUE");
JMenuitem mcyan=new JMenuitem("CYAN");
JMenuitem mred=new JMenuitem("RED");pm.add(mblue);
pm.add(mcyan);
pm.add(red);mblue.addActonListner(this);
mcyan.addActonListner(this);
mred.addActonListner(this);
add(l1);
addMouseListner(new myclass());
}class myclass extends MouseAdapter
{
public void MouseReleased(MouseEvent e)
{
if(e.ispopupTrigger())
{
popshow(e.getcomponent(),e.getx(),e.gety());
popup pt=new popup();pt.settitle("mimi popup");
pt.setVIsible(true);
pt.setsize(400,400);pt.getcontentpane.add(pm);
}
}
}

Hey, ever wonder why programmers love to indent so much? 'Cause it helps when scanning and reading the code!
java.awt.*;
import java.applet.*;
import java .awt.event.*;
import java.swing.*;
public class popup extends JApplet implements ActionListner
{
JLabel l1;
JPopupmenu pm;
public void poptest()
{
l1=new label("right cclick");
pm=new popupmenu();JMenuitem mblue=new JMenuitem("BLUE");
JMenuitem mcyan=new JMenuitem("CYAN");
JMenuitem mred=new JMenuitem("RED");pm.add(mblue);
pm.add(mcyan);
pm.add(red);mblue.addActonListner(this);
mcyan.addActonListner(this);
mred.addActonListner(this);
add(l1);
addMouseListner(new myclass());
}class myclass extends MouseAdapter
{
public void MouseReleased(MouseEvent e)
{
if(e.ispopupTrigger())
{
popshow(e.getcomponent(),e.getx(),e.gety());
popup pt=new popup();pt.settitle("mimi popup");
pt.setVIsible(true);
pt.setsize(400,400);pt.getcontentpane.add(pm);
}
}
}Find it yet?
No? Then read this: You never closed this:
public class popup extends JApplet implements ActionListner

And I guess, once you've corrected that, the compiler will then complain that it can't find interface ActionListner. But at the moment it doesn't worry about the spelling until you get the punctuation right!

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |