Help With illegal start of expression
hi all.. plz help me
Code :
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Mouse implements MouseMotionListener{
JFrame f;
JLabel coord;
public void initGUI(){
JFrame f=new JFrame();
JLabel coord=new JLabel();
Container con=f.getContentPane();
con.add(coord);
f.setLayout(new FlowLayout());
f.setSize(400,400);
f.setVisible(true);
f.addMouseMotionListener(this);
public void mouseDragged(MouseEvent me){int x=me.getX();
int y=me.getY();
coord.setText("Dragged at [" + x + "," + y + "]" ); }
public void mouseMoved(MouseEvent me){
int x = me.getX();
int y = me.getY();
coord.setText("Moved at [" + x + "," + y + "]" );
}
}
public void Mouse(){
initGUI();
}
public static void main(String args[]){
Mouse ex=new Mouse();
}
}
Re: Help With illegal start of expression
Moved to own thread.
Please explain your problem.
Also please edit the code and format it properly.
Re: Help With illegal start of expression
inshal: please don't hijack someone else's question. I have moved your question to its own thread, and Norm has added code tags so that the code retains its formatting. You will want to give us the details on what's wrong with your code including posting any and all error messages and any questions that you might have.
need help with illegal start of expression
Code :
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Mouse implements MouseMotionListener{
JFrame f;
JLabel coord;
public void initGUI(){
JFrame f=new JFrame();
JLabel coord=new JLabel();
Container con=f.getContentPane();
con.add(coord);
f.setLayout(new FlowLayout());
f.setSize(400,400);
f.setVisible(true);
f.addMouseMotionListener(this);
public void mouseDragged(MouseEvent me){int x=me.getX();
int y=me.getY();
coord.setText("Dragged at [" + x + "," + y + "]" ); }
public void mouseMoved(MouseEvent me){
int x = me.getX();
int y = me.getY();
coord.setText("Moved at [" + x + "," + y + "]" );
}
}
public void Mouse(){
initGUI();
}
public static void main(String args[]){
Mouse ex=new Mouse();
}
}
Re: Help With illegal start of expression
Merged with other thread.
Please explain your problem. Copy and paste full text of error messages
Also please edit the code and format it properly.
Re: Help With illegal start of expression
illelgal start of expression at line 16 and 20... sorry but i am doing it with cmd window.. dont know how to copy that text...
plz help... :)
Re: Help With illegal start of expression
Check that all the {s have a matching }
and that all method definitions end (the ending }) before another method's definition starts.
On windows: To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here.