Results 1 to 9 of 9
  1. #1
    nobody is offline Member
    Join Date
    Oct 2008
    Posts
    5
    Rep Power
    0

    Default mouse click do not work after repaint

    hi,
    after I press the button which will call the repaint(); the mouse click stop

    L.repaint();


    thanks

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,327
    Rep Power
    25

    Default

    What is your question?
    We'll need to see the code to be able to help.

  3. #3
    nobody is offline Member
    Join Date
    Oct 2008
    Posts
    5
    Rep Power
    0

    Default

    /*
    * myform.java
    *
    * Created on 25 سبتمبر, 2008, 02:14 ص
    */

    package loadimageapp1;
    import javax.swing.*;
    import java.awt.event.*;
    ////
    import java.awt.geom.Ellipse2D;
    import java.awt.*;
    import java.io.*;
    import javax.imageio.*;
    ////
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    /**
    *
    * @author Noura Mohammed
    */
    public class myform extends javax.swing.JFrame {
    LoadImageApp L=new LoadImageApp();
    public static String flage1="0" ;
    public static boolean mouseclicked = false;

    DrawEvent draw=new DrawEvent();
    /** Creates new form myform */
    public myform() {
    initComponents();

    jTabbedPane1.add("Simulation ", L);
    // jTabbedPane1.add("LoadImageApp", draw);

    jTabbedPane1.updateUI();

    }

    /** 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.
    */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

    jTabbedPane1 = new javax.swing.JTabbedPane();
    jButton1 = new javax.swing.JButton();
    jTextField1 = new javax.swing.JTextField();
    jTextField2 = new javax.swing.JTextField();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jPanel1 = new javax.swing.JPanel();
    jLabel5 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    ypos = new javax.swing.JLabel();
    xpos = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    sensorID = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    tempVal = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);

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

    jButton1.setText("event");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    }
    });

    jTextField1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField1ActionPerformed(evt);
    }
    });

    jLabel1.setText("X");

    jLabel2.setText("Y");

    jPanel1.setBorder(javax.swing.BorderFactory.create TitledBorder("Sensor Information"));
    jPanel1.setForeground(new java.awt.Color(0, 0, 255));

    jLabel5.setForeground(new java.awt.Color(153, 153, 153));
    jLabel5.setText("Y Postion");

    jLabel4.setForeground(new java.awt.Color(153, 153, 153));
    jLabel4.setText("X Postion");

    ypos.setForeground(new java.awt.Color(0, 0, 255));
    ypos.setText("yyy");

    xpos.setForeground(new java.awt.Color(0, 0, 255));
    xpos.setText("xxxx?");

    jLabel3.setForeground(new java.awt.Color(153, 153, 153));
    jLabel3.setText("Sensor ID");

    sensorID.setForeground(new java.awt.Color(51, 0, 255));
    sensorID.setText("to see");

    jLabel6.setForeground(new java.awt.Color(153, 153, 153));
    jLabel6.setText("Temperature");

    tempVal.setForeground(new java.awt.Color(0, 0, 255));
    tempVal.setText("temperatureeee");

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addComponent(jLabel6)
    .addGap(18, 18, 18)
    .addComponent(tempVal))
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel3)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGap(2, 2, 2)
    .addComponent(jLabel4))
    .addComponent(jLabel5))
    .addGap(36, 36, 36)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING)
    .addComponent(ypos, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(sensorID, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(xpos, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))))
    .addContainerGap(93, Short.MAX_VALUE))
    );
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGap(12, 12, 12)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel3)
    .addComponent(sensorID))
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel4)
    .addComponent(xpos, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(9, 9, 9)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel5)
    .addComponent(ypos))
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel6)
    .addComponent(tempVal)))
    );

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 797, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(85, 85, 85)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.TRAILING)
    .addComponent(jButton1)
    .addGroup(layout.createSequentialGroup()
    .addGap(6, 6, 6)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 22, Short.MAX_VALUE)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    .addComponent(jTextField2)
    .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE))
    .addGap(61, 61, 61)))
    .addGap(171, 171, 171))
    .addGroup(layout.createSequentialGroup()
    .addGap(57, 57, 57)
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addContainerGap())))
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILI NG, layout.createSequentialGroup()
    .addGap(33, 33, 33)
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 51, Short.MAX_VALUE)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    .addComponent(jLabel1)
    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(18, 18, 18)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    .addComponent(jLabel2)
    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(112, 112, 112)
    .addComponent(jButton1)
    .addGap(243, 243, 243))
    .addGroup(layout.createSequentialGroup()
    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 628, Short.MAX_VALUE)
    .addContainerGap())
    );

    pack();
    }// </editor-fold>

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    JFrame frame;
    frame = new JFrame("Show Message Dialog");
    String text1,text2;
    text1= jTextField1.getText();
    text2= jTextField2.getText();
    double X1=0,Y1=0;

    if( text1.equals("")|| text2.equals("") ){
    //
    // jTextField3.toString()="you do not enter a complete value";
    // ShowMessage(Text,"MyApplication");
    //System.out.println("you do not enter a complete value");
    JOptionPane.showMessageDialog(frame,"you do not enter a complete value for postion");

    }
    //JOptionPane.showMessageDialog(frame,text1);
    else
    {
    // int X1=Integer.parseInt(text1);
    /* try{ X1 = Integer.parseInt(text1);
    Y1 = Integer.parseInt(text2);}
    catch(NumberFormatException e){} */


    try {
    X1 = Double.valueOf(text1.trim()).doubleValue();
    Y1 = Double.valueOf(text2.trim()).doubleValue();
    // System.out.println("double d = " + d);
    } catch (NumberFormatException nfe){}
    Graphics g11;

    flage1="5";

    //JOptionPane.showMessageDialog(frame,flage1);
    L.setxy(X1, Y1);
    L.setflag2(flage1);
    // String h=L.getflag2();

    // g11=L.getG();
    // JOptionPane.showMessageDialog(frame,"now");
    L.repaint();
    //jTabbedPane1MouseClicked(evt);
    //evt.consume();

    // L.paint(g11);
    // L.repaint();
    //L.drawMan(X1, Y1, g11);
    // L.callPaint();
    //L.dodo();
    // draw. setpstion(X1,Y1);
    //draw.paint(g11);

    // JOptionPane.showMessageDialog(frame,"End program");
    //draw.setpstion(X1, Y1);
    // jTabbedPane1.add("LoadImageApp", L);
    myform m=new myform();
    //L.
    // JOptionPane.showMessageDialog(frame,"ee");

    //myform.

    }

    }

    private void jTextField1ActionPerformed(java.awt.event.ActionEv ent evt) {
    // TODO add your handling code here:
    }

    private void jTabbedPane1MouseClicked(java.awt.event.MouseEvent evt) {
    // TODO add your handling code here:
    // computerDelay.stop();
    mouseclicked = true;
    for (Sensor s : L.sensors)
    {
    if(s.sensorRect.contains(evt.getX(),evt.getY()))
    {

    myform.sensorID.setText(Integer.toString(s.getid() ));
    myform.ypos.setText(Double.toString(s.gety()));
    myform.xpos.setText(Double.toString(s.getx()));
    myform.tempVal.setText(Double.toString(s.getTemper ature()));

    }
    }
    // L.repaint();
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new myform().setVisible(true);
    }
    // setSize(new Dimension(800,600));
    });
    }


    // setBorder(javax.swing.BorderFactory.createTitledBo rder(""));

    //
    ///////////

    /*private void formMouseClicked(java.awt.event.MouseEvent evt) {
    // TODO add your handling code here:
    for (Sensor s : sensors)
    {
    if(s.sensorRect.contains(evt.getX(),evt.getY()))
    {

    myform.sensorID.setText(Integer.toString(s.getid() ));
    myform.ypos.setText(Double.toString(s.gety()));
    myform.xpos.setText(Double.toString(s.getx()));
    myform.tempVal.setText(Double.toString(s.getTemper ature()));

    }
    }

    }*/
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    public static javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    public static javax.swing.JLabel sensorID;
    public static javax.swing.JLabel tempVal;
    public static javax.swing.JLabel xpos;
    public static javax.swing.JLabel ypos;
    // End of variables declaration

    }

    and the second class is


    ////



    package loadimageapp1;
    import java.awt.Color;
    import java.awt.Graphics;
    //import java.awt.Graphics2D;
    //import java.awt.Rectangle;
    import java.awt.geom.Ellipse2D;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.swing.*;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.geom.Ellipse2D;

    /**
    * This class demonstrates how to load an Image from an external file
    */
    public class LoadImageApp extends Component {
    double xx,yy;
    // Sensor sensor[]=new Sensor();
    public Sensor[] sensors = new Sensor[50];
    Sensor[] master=new Sensor[8];
    boolean drawsensor_value=false;

    Graphics g;
    BufferedImage img;

    public void setxy(double X3,double Y3){
    xx=X3;
    yy=Y3;
    JFrame frame;


    }
    String flag2= myform.flage1;
    public void setflag2(String tempflage) {
    flag2= tempflage;
    }


    public void whichsensordetect(){
    Graphics2D g2 = (Graphics2D) g;
    for(int h=0;h<50;h++)
    {
    // if(sensors[h].X_pos>(yy-90)&&sensors[h].Y_pos<(xx+90))
    if(sensors[h].X_pos>(xx-63.3)&&sensors[h].X_pos<(xx+63.3))
    if(sensors[h].Y_pos>(yy-63.3)&&sensors[h].Y_pos<(yy+63.3))
    { g2.setPaint(Color.BLUE);
    g2.fill (new Ellipse2D.Double(sensors[h].X_pos,sensors[h].Y_pos,10,10));

    // g2.fill (new Ellipse2D.Double(44,66,19,19));
    g2.setPaint(Color.BLACK);
    }
    }
    }

    ///

    public void paint(Graphics g) {
    Dimension size = getSize();
    myform h=new myform();
    h.mouseclicked = false;


    super.paint(g);
    setG(g);

    Graphics2D g2 = (Graphics2D) g;


    g.drawImage(img, 0, 0, null);
    g2.draw(new Rectangle.Double(700, 250,50,50));
    //g2.fill3DRect(700, 250,50,50);
    g2.fill (new Rectangle.Double(700, 250,50,50));
    //if (drawsensor_value==false){
    draw_sensor();
    draw_master();
    //drawsensor_value=true;
    //}


    if(flag2.equals("5") )
    {

    g2.setPaint(Color.RED);
    g2.fill (new Ellipse2D.Double(xx,yy,15,15));
    g2.setPaint(Color.BLACK);
    whichsensordetect();
    }
    // initComponents();
    }
    public void draw_sensor(){
    Graphics2D g2 = (Graphics2D) g;
    /* int X=0,Y=0;
    for( int i=0;i<9;i++){
    g2.draw(new Ellipse2D.Double(X,Y,20,20));
    g2.fill (new Ellipse2D.Double(X,Y,20,20));

    sensors[i] = new Sensor(i,X,Y);
    X=X+50;
    Y=Y+50;
    }*///JFrame frame;



    double x=0;
    double y=0;
    int id=0;
    int id1=1;
    //int sens[];
    for(int j=0;j<5;j++){
    x=0;

    for(int i=0;i<10;i++)
    {
    // Color fg3D = Color.lightGray;
    Color fg3D = Color.green;
    g2.setPaint(fg3D);
    //x=x+55;
    g2.draw(new Ellipse2D.Double(x,y,5,5));
    g2.fill(new Ellipse2D.Double(x,y,5,5));

    sensors[id] = new Sensor(id1,x,y,30);


    id++;
    id1++;
    x=x+63.43;
    }
    // g2.draw(new Ellipse2D.Double(x,y,10,10));
    //g2.fill(new Ellipse2D.Double(x,y,10,10));
    y=y+126.6;

    }

    }
    public void routing_event(double x1,double y1){
    x1=x1+63.43;
    Graphics2D g2 = (Graphics2D) g;
    // g2.fill(new Ellipse2D.Double(55,55,19,19));
    //for (int f=0;f<10;f++){
    while(x1<570.88){
    g2.setPaint(Color.YELLOW);
    // g2.draw(new Ellipse2D.Double(x1,y1,10,10));
    g2.fill(new Ellipse2D.Double(x1,y1,10,10));
    x1=x1+63.43;
    //}
    }
    }
    public void draw_master(){
    double X=634.3,Y=63.3;
    int m_id=0;
    Graphics2D g2 = (Graphics2D) g;
    for(int i=0;i<8;i++)
    {
    g2.setPaint(Color.BLACK);
    g2.draw(new Ellipse2D.Double(X,Y,15,15));
    g2.fill(new Ellipse2D.Double(X,Y,15,15));
    master[m_id] = new Sensor(m_id,X,Y);
    //master[m_id].setMaster();
    //g2.fill(new Ellipse2D.Double(X,Y,40,15));
    //Y=Y+126.6;
    Y=Y+63.3;
    }
    }
    public LoadImageApp() {

    try {
    img = ImageIO.read(new File("Mena.jpg"));
    } catch (IOException e) {
    }
    //initComponents();
    }
    public Graphics getG() {
    return g;
    }

    public void setG(Graphics g) {
    this.g = g;
    }


    public Dimension getPreferredSize() {
    if (img == null) {
    return new Dimension(100,100);
    } else {
    return new Dimension(img.getWidth(null), img.getHeight(null));
    }
    }


    //''''''''''''''''''''''''''''''''enev whene i remove comment it have the same effect
    /* public void initComponents() {

    // setBorder(javax.swing.BorderFactory.createTitledBo rder(""));
    addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent evt) {
    // formMouseClicked(evt);
    }
    });*/

    // }//
    ///////////

    private void formMouseClicked(java.awt.event.MouseEvent evt) {
    // TODO add your handling code here:
    for (Sensor s : sensors)
    {
    if(s.sensorRect.contains(evt.getX(),evt.getY()))
    {

    myform.sensorID.setText(Integer.toString(s.getid() ));
    myform.ypos.setText(Double.toString(s.gety()));
    myform.xpos.setText(Double.toString(s.getx()));
    myform.tempVal.setText(Double.toString(s.getTemper ature()));

    }
    }

    }

    ////////
    }






    the thired


    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package loadimageapp1;
    import java.awt.Rectangle;

    /**
    *
    * @author Noura Mohammed
    */
    public class Sensor {
    public int ID;
    public double X_pos;
    public double Y_pos;
    Rectangle.Double sensorRect , coverageRect;
    double Temperature;
    Sensor(){}
    Sensor(int id,double x,double y)
    {
    ID=id;
    X_pos=x;
    Y_pos=y;
    // Temperature=temp1;
    //master=M;
    sensorRect = new Rectangle.Double(X_pos, Y_pos, 30, 30);
    coverageRect = new Rectangle.Double(X_pos, Y_pos, 30, 30);

    }
    Sensor(int id,double x,double y,double temp1)
    {
    ID=id;
    X_pos=x;
    Y_pos=y;
    Temperature=temp1;
    //master=M;
    sensorRect = new Rectangle.Double(X_pos, Y_pos, 30, 30);
    coverageRect = new Rectangle.Double(X_pos, Y_pos, 30, 30);

    }
    public double getx(){
    return X_pos;
    }
    public double gety(){
    return Y_pos;
    }
    public int getid()
    {
    return ID;
    }

    void setTemperature(double temp){
    Temperature=temp;
    }
    double getTemperature(){
    return Temperature;
    }
    }

  4. #4
    nobody is offline Member
    Join Date
    Oct 2008
    Posts
    5
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    What is your question?
    We'll need to see the code to be able to help.
    after i press event button mouse click does not work

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,327
    Rep Power
    25

    Default

    Were is the "event button"? How do I find it? Please give variable name.
    Add println() statements to the mouse listeners to show that they are being called. In the MouseAdapter use the @Override statement to have the compiler check that you've coded the methods correctly.

    When I tried to compile your code, I get many errors. There are a lot of blanks in the middle of statements.
    Can you post code that compiles? Have only one file with all the classes. Only have the class with main() be public.
    Last edited by Norm; 10-04-2008 at 05:19 PM.

  6. #6
    nobody is offline Member
    Join Date
    Oct 2008
    Posts
    5
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Were is the "event button"? How do I find it? Please give variable name.
    Add println() statements to the mouse listeners to show that they are being called. In the MouseAdapter use the @Override statement to have the compiler check that you've coded the methods correctly.

    When I tried to compile your code, I get many errors. There are a lot of blanks in the middle of statements.
    Can you post code that compiles? Have only one file with all the classes. Only have the class with main() be public.
    hello


    the java class



    package loadimageapp1;
    import java.awt.Color;
    import java.awt.Graphics;
    //import java.awt.Graphics2D;
    //import java.awt.Rectangle;
    import java.awt.geom.Ellipse2D;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.swing.*;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.geom.Ellipse2D;

    /**
    * This class demonstrates how to load an Image from an external file
    */
    public class LoadImageApp extends Component {
    double xx,yy;
    // Sensor sensor[]=new Sensor();
    Sensor[] sensors = new Sensor[50];
    Sensor[] master=new Sensor[8];
    boolean drawsensor_value=false;

    Graphics g;
    BufferedImage img;

    public void setxy(double X3,double Y3){
    xx=X3;
    yy=Y3;
    JFrame frame;

    // frame = new JFrame("yaa rby");
    // JOptionPane.showMessageDialog(frame,sensors[1].X_pos);
    }
    String flag2= myform.flage1;
    public void setflag2(String tempflage) {
    flag2= tempflage;
    }

    //public void repaint(){//paint(g);
    //}
    //@Override
    public void whichsensordetect(){
    Graphics2D g2 = (Graphics2D) g;
    for(int h=0;h<50;h++)
    {
    // if(sensors[h].X_pos>(yy-90)&&sensors[h].Y_pos<(xx+90))
    if(sensors[h].X_pos>(xx-63.3)&&sensors[h].X_pos<(xx+63.3))
    if(sensors[h].Y_pos>(yy-63.3)&&sensors[h].Y_pos<(yy+63.3))
    { g2.setPaint(Color.BLUE);
    g2.fill (new Ellipse2D.Double(sensors[h].X_pos,sensors[h].Y_pos,10,10));
    routing_event(sensors[h].X_pos,sensors[h].Y_pos);
    // g2.fill (new Ellipse2D.Double(44,66,19,19));
    g2.setPaint(Color.BLACK);
    }
    }
    }

    ///
    public void master2 (double cor , double cor1){
    Graphics2D g2=(Graphics2D) g;
    cor1=cor1+63.3;
    cor=cor+63.43;
    //for(int j=0 ;j<3 ;j++ ) {
    // if (cor1!=99)
    // {
    // goto();
    // exite(1);
    //exite(0);
    //}

    if(cor1<(63.3*4))
    {
    for (int q=0;q<4;q++){
    if(cor1<=(63.3*4)){
    // cor=cor+63.43;
    g2.draw(new Ellipse2D.Double(cor,cor1,10,10));
    g2.fill(new Ellipse2D.Double(cor,cor1,10,10));
    cor1=cor1+63.3;}}}
    else{//cor=cor+63.43;

    if(cor1>63.3*3){
    for(int v=0;v<4;v++){
    if(cor1>63.3*4){
    // if(cor1!=(63.3*4))

    cor1=cor1-63.3;
    g2.draw(new Ellipse2D.Double(cor,cor1,10,10));
    g2.fill(new Ellipse2D.Double(cor,cor1,10,10));
    }}}
    }
    //}}

    //}
    }

    //
    public void paint(Graphics g) {
    Dimension size = getSize();

    // diameter
    // int d = Math.min(size.width, size.height);
    // int x = (size.width - d)/2;
    // int y = (size.height - d)/2;

    super.paint(g);
    setG(g);

    Graphics2D g2 = (Graphics2D) g;
    // redtowhite = new GradientPaint(0,0,color.RED,100, 0,color.WHITE);
    //g2.setPaint(redtowhite)
    //g2.fill (new Ellipse2D.Double(0, 0, 100, 50));
    //flag2="5";

    // else
    // {
    /* if(myform.jTabbedPane1.getSelectedIndex() == 0)
    {
    myform.sensorID.setVisible(true);
    myform.tempVal.setVisible(true);
    myform.xpos.setVisible(true);
    myform.ypos.setVisible(true);
    // myform.jLabel.setVisible(true);
    //myform.estimatedX.setVisible(true);
    // myform.estimatedY.setVisible(true);
    // myform.realx.setText("Real-X :");
    // myform.realY.setText("Real-Y : ");

    }*/
    g.drawImage(img, 0, 0, null);
    g2.draw(new Rectangle.Double(700, 250,50,50));
    //g2.fill3DRect(700, 250,50,50);
    g2.fill (new Rectangle.Double(700, 250,50,50));
    //if (drawsensor_value==false){
    draw_sensor();
    draw_master();
    //drawsensor_value=true;
    //}
    //////////
    // g2.draw(new Ellipse2D.Double(100,100,20,20));
    // g2.fill (new Ellipse2D.Double(100,100,20,20));
    // }
    //g2.draw(new Ellipse2D.Double(5,100,20,20));
    // g2.fill (new Ellipse2D.Double(5,100,20,20));


    if(flag2.equals("5") )
    {

    g2.setPaint(Color.RED);
    g2.fill (new Ellipse2D.Double(xx,yy,15,15));
    g2.setPaint(Color.BLACK);
    whichsensordetect();
    }
    // initComponents();
    }
    public void draw_sensor(){
    Graphics2D g2 = (Graphics2D) g;
    /* int X=0,Y=0;
    for( int i=0;i<9;i++){
    g2.draw(new Ellipse2D.Double(X,Y,20,20));
    g2.fill (new Ellipse2D.Double(X,Y,20,20));
    // sensors[i].ID=i;
    // sensors[i].X_pos=X;
    // sensors[i].X_pos=Y;
    sensors[i] = new Sensor(i,X,Y);
    X=X+50;
    Y=Y+50;
    }*///JFrame frame;
    // frame = new JFrame("yaa rby");


    double x=0;
    double y=0;
    int id=0;
    int id1=1;
    //int sens[];
    for(int j=0;j<5;j++){
    x=0;

    for(int i=0;i<10;i++)
    {
    // Color fg3D = Color.lightGray;
    Color fg3D = Color.green;
    g2.setPaint(fg3D);
    //x=x+55;
    g2.draw(new Ellipse2D.Double(x,y,5,5));
    g2.fill(new Ellipse2D.Double(x,y,5,5));

    sensors[id] = new Sensor(id1,x,y,30);


    id++;
    id1++;
    x=x+63.43;
    }
    // g2.draw(new Ellipse2D.Double(x,y,10,10));
    //g2.fill(new Ellipse2D.Double(x,y,10,10));
    y=y+126.6;

    }

    }
    public void routing_event(double x1,double y1){
    x1=x1+63.43;
    Graphics2D g2 = (Graphics2D) g;
    // g2.fill(new Ellipse2D.Double(55,55,19,19));
    //for (int f=0;f<10;f++){
    while(x1<570.88){
    g2.setPaint(Color.YELLOW);
    // g2.draw(new Ellipse2D.Double(x1,y1,10,10));
    g2.fill(new Ellipse2D.Double(x1,y1,10,10));
    x1=x1+63.43;
    //}
    }
    master2 (x1-63.43 , y1);}
    public void draw_master(){
    double X=634.3,Y=63.3;
    int m_id=0;
    Graphics2D g2 = (Graphics2D) g;
    for(int i=0;i<8;i++)
    {
    g2.setPaint(Color.BLACK);
    g2.draw(new Ellipse2D.Double(X,Y,15,15));
    g2.fill(new Ellipse2D.Double(X,Y,15,15));
    master[m_id] = new Sensor(m_id,X,Y);
    //master[m_id].setMaster();
    //g2.fill(new Ellipse2D.Double(X,Y,40,15));
    //Y=Y+126.6;
    Y=Y+63.3;
    }
    }
    public LoadImageApp() {

    try {
    img = ImageIO.read(new File("Mena.jpg"));
    } catch (IOException e) {
    }
    initComponents();
    }
    public Graphics getG() {
    return g;
    }

    public void setG(Graphics g) {
    this.g = g;
    }


    public Dimension getPreferredSize() {
    if (img == null) {
    return new Dimension(100,100);
    } else {
    return new Dimension(img.getWidth(null), img.getHeight(null));
    }
    }


    //''''''''''''''''''''''''''''''''
    public void initComponents() {

    // setBorder(javax.swing.BorderFactory.createTitledBo rder(""));
    addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent evt) {
    formMouseClicked(evt);
    }
    });

    }//
    ///////////

    private void formMouseClicked(java.awt.event.MouseEvent evt) {
    // TODO add your handling code here:
    for (Sensor s : sensors)
    {
    if(s.sensorRect.contains(evt.getX(),evt.getY()))
    {

    myform.sensorID.setText(Integer.toString(s.getid() ));
    myform.ypos.setText(Double.toString(s.gety()));
    myform.xpos.setText(Double.toString(s.getx()));
    myform.tempVal.setText(Double.toString(s.getTemper ature()));

    }
    }

    }

    ////////
    }





    there is the Jframe class

    /*
    * myform.java
    *
    * Created on 25 سبتمبر, 2008, 02:14 ص
    */

    package loadimageapp1;
    import javax.swing.*;
    import java.awt.event.*;
    ////
    import java.awt.geom.Ellipse2D;
    import java.awt.*;
    import java.io.*;
    import javax.imageio.*;
    ////
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    /**
    *
    * @author Noura Mohammed
    */
    public class myform extends javax.swing.JFrame {
    LoadImageApp L=new LoadImageApp();
    public static String flage1="0" ;
    public static boolean mouseclicked = false;

    DrawEvent draw=new DrawEvent();
    /** Creates new form myform */
    public myform() {
    initComponents();

    jTabbedPane1.add("Simulation ", L);
    // jTabbedPane1.add("LoadImageApp", draw);

    jTabbedPane1.updateUI();

    }

    /** 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.
    */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

    jTabbedPane1 = new javax.swing.JTabbedPane();
    jButton1 = new javax.swing.JButton();
    jTextField1 = new javax.swing.JTextField();
    jTextField2 = new javax.swing.JTextField();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jPanel1 = new javax.swing.JPanel();
    jLabel5 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    ypos = new javax.swing.JLabel();
    xpos = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    sensorID = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    tempVal = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);

    jButton1.setText("event");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    }
    });

    jTextField1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField1ActionPerformed(evt);
    }
    });

    jLabel1.setText("X");

    jLabel2.setText("Y");

    jPanel1.setBorder(javax.swing.BorderFactory.create TitledBorder("Sensor Information"));
    jPanel1.setForeground(new java.awt.Color(0, 0, 255));

    jLabel5.setForeground(new java.awt.Color(153, 153, 153));
    jLabel5.setText("Y Postion");

    jLabel4.setForeground(new java.awt.Color(153, 153, 153));
    jLabel4.setText("X Postion");

    ypos.setForeground(new java.awt.Color(0, 0, 255));
    ypos.setText("yyy");

    xpos.setForeground(new java.awt.Color(0, 0, 255));
    xpos.setText("xxxx?");

    jLabel3.setForeground(new java.awt.Color(153, 153, 153));
    jLabel3.setText("Sensor ID");

    sensorID.setForeground(new java.awt.Color(51, 0, 255));
    sensorID.setText("to see");

    jLabel6.setForeground(new java.awt.Color(153, 153, 153));
    jLabel6.setText("Temperature");

    tempVal.setForeground(new java.awt.Color(0, 0, 255));
    tempVal.setText("temperatureeee");

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addComponent(jLabel6)
    .addGap(18, 18, 18)
    .addComponent(tempVal))
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel3)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGap(2, 2, 2)
    .addComponent(jLabel4))
    .addComponent(jLabel5))
    .addGap(36, 36, 36)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING)
    .addComponent(ypos, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(sensorID, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(xpos, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))))
    .addContainerGap(93, Short.MAX_VALUE))
    );
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGap(12, 12, 12)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel3)
    .addComponent(sensorID))
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel4)
    .addComponent(xpos, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(9, 9, 9)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel5)
    .addComponent(ypos))
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel6)
    .addComponent(tempVal)))
    );

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 797, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(85, 85, 85)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.TRAILING)
    .addComponent(jButton1)
    .addGroup(layout.createSequentialGroup()
    .addGap(6, 6, 6)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 22, Short.MAX_VALUE)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    .addComponent(jTextField2)
    .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE))
    .addGap(61, 61, 61)))
    .addGap(171, 171, 171))
    .addGroup(layout.createSequentialGroup()
    .addGap(57, 57, 57)
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addContainerGap())))
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILI NG, layout.createSequentialGroup()
    .addGap(33, 33, 33)
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 51, Short.MAX_VALUE)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    .addComponent(jLabel1)
    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(18, 18, 18)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    .addComponent(jLabel2)
    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(112, 112, 112)
    .addComponent(jButton1)
    .addGap(243, 243, 243))
    .addGroup(layout.createSequentialGroup()
    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 628, Short.MAX_VALUE)
    .addContainerGap())
    );

    pack();
    }// </editor-fold>

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    JFrame frame;
    frame = new JFrame("Show Message Dialog");
    String text1,text2;
    text1= jTextField1.getText();
    text2= jTextField2.getText();
    double X1=0,Y1=0;

    if( text1.equals("")|| text2.equals("") ){
    //

    JOptionPane.showMessageDialog(frame,"you do not enter a complete value for postion");

    }
    //JOptionPane.showMessageDialog(frame,text1);
    else
    {



    try {
    X1 = Double.valueOf(text1.trim()).doubleValue();
    Y1 = Double.valueOf(text2.trim()).doubleValue();
    // System.out.println("double d = " + d);
    } catch (NumberFormatException nfe){}
    Graphics g11;

    flage1="5";

    //JOptionPane.showMessageDialog(frame,flage1);
    L.setxy(X1, Y1);
    L.setflag2(flage1);
    // String h=L.getflag2();

    // g11=L.getG();
    // JOptionPane.showMessageDialog(frame,"now");
    L.repaint();
    //jTabbedPane1MouseClicked(evt);
    //evt.consume();

    // L.paint(g11);
    // L.repaint();
    //L.drawMan(X1, Y1, g11);
    // L.callPaint();
    //L.dodo();
    // draw. setpstion(X1,Y1);
    //draw.paint(g11);

    // JOptionPane.showMessageDialog(frame,"End program");
    //draw.setpstion(X1, Y1);
    // jTabbedPane1.add("LoadImageApp", L);
    myform m=new myform();


    }

    }

    private void jTextField1ActionPerformed(java.awt.event.ActionEv ent evt) {
    // TODO add your handling code here:
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new myform().setVisible(true);
    }
    // setSize(new Dimension(800,600));
    });
    }


    // setBorder(javax.swing.BorderFactory.createTitledBo rder(""));

    //
    ///////////


    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    public static javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    public static javax.swing.JLabel sensorID;
    public static javax.swing.JLabel tempVal;
    public static javax.swing.JLabel xpos;
    public static javax.swing.JLabel ypos;
    // End of variables declaration

    }



    the sensor class

    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package loadimageapp1;
    import java.awt.Rectangle;

    /**
    *
    *
    */
    public class Sensor {
    public int ID;
    public double X_pos;
    public double Y_pos;
    Rectangle.Double sensorRect , coverageRect;
    double Temperature;
    Sensor(){}
    Sensor(int id,double x,double y)
    {
    ID=id;
    X_pos=x;
    Y_pos=y;
    // Temperature=temp1;
    //master=M;
    sensorRect = new Rectangle.Double(X_pos, Y_pos, 30, 30);
    coverageRect = new Rectangle.Double(X_pos, Y_pos, 30, 30);

    }
    Sensor(int id,double x,double y,double temp1)
    {
    ID=id;
    X_pos=x;
    Y_pos=y;
    Temperature=temp1;
    //master=M;
    sensorRect = new Rectangle.Double(X_pos, Y_pos, 30, 30);
    coverageRect = new Rectangle.Double(X_pos, Y_pos, 30, 30);

    }
    public double getx(){
    return X_pos;
    }
    public double gety(){
    return Y_pos;
    }
    public int getid()
    {
    return ID;
    }

    void setTemperature(double temp){
    Temperature=temp;
    }
    double getTemperature(){
    return Temperature;
    }
    }




    i called the package which contains all the above classes loadimageapp1



    thanks

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,327
    Rep Power
    25

    Default

    Your posted code is full of errors:
    D:\JavaDevelopment\Testing\JavaForum\myform.java:2 87: ')' expected
    myform.tempVal.setText(Double.toString(s.getTemper ature()));
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:2 87: ';' expected
    myform.tempVal.setText(Double.toString(s.getTemper ature()));
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 01: class, interface, or enum expected
    there is the Jframe class
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 01: <identifier> expected
    there is the Jframe class
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 10: illegal start of type
    import javax.swing.*;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 10: <identifier> expected
    import javax.swing.*;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 11: illegal start of type
    import java.awt.event.*;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 11: <identifier> expected
    import java.awt.event.*;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 13: illegal start of type
    import java.awt.geom.Ellipse2D;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 13: <identifier> expected
    import java.awt.geom.Ellipse2D;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 14: illegal start of type
    import java.awt.*;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 14: <identifier> expected
    import java.awt.*;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 15: illegal start of type
    import java.io.*;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 15: <identifier> expected
    import java.io.*;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 16: illegal start of type
    import javax.imageio.*;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 16: <identifier> expected
    import javax.imageio.*;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 18: illegal start of type
    import java.util.logging.Level;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 18: <identifier> expected
    import java.util.logging.Level;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 19: illegal start of type
    import java.util.logging.Logger;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 19: <identifier> expected
    import java.util.logging.Logger;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 20: illegal start of type
    import javax.swing.UIManager;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 20: <identifier> expected
    import javax.swing.UIManager;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 21: illegal start of type
    import javax.swing.UnsupportedLookAndFeelException;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 21: <identifier> expected
    import javax.swing.UnsupportedLookAndFeelException;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 67: ')' expected
    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 67: not a statement
    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 67: ';' expected
    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 86: ')' expected
    jPanel1.setBorder(javax.swing.BorderFactory.create TitledBorder("Sensor Information"));
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:3 86: ';' expected
    jPanel1.setBorder(javax.swing.BorderFactory.create TitledBorder("Sensor Information"));
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 16: ')' expected
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 16: not a statement
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 16: ';' expected
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 35: ';' expected
    .addContainerGap(93, Short.MAX_VALUE))
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 38: ')' expected
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 38: not a statement
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 38: ';' expected
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 44: ')' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 44: not a statement
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 44: ';' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 52: ')' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 52: not a statement
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 52: ';' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 52: not a statement
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 52: ';' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 52: not a statement
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 52: ';' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 55: ';' expected
    .addComponent(tempVal)))
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 64: ')' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 64: not a statement
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 64: ';' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 67: ')' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.TRAILING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 67: not a statement
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.TRAILING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 67: ';' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.TRAILING)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 71: ')' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 71: not a statement
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 71: ';' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 73: ';' expected
    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 74: ')' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 22, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 74: not a statement
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 22, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 74: ';' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 22, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 74: not a statement
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 22, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 74: ';' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 22, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 75: ')' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 75: not a statement
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 75: ';' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 77: ';' expected
    .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE))
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 78: ';' expected
    .addGap(61, 61, 61)))
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 79: ';' expected
    .addGap(171, 171, 171))
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 83: ';' expected
    .addContainerGap())))
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 87: ')' expected
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILI NG, layout.createSequentialGroup()
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 87: not a statement
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILI NG, layout.createSequentialGroup()
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 87: ';' expected
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILI NG, layout.createSequentialGroup()
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 90: ')' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 51, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 90: not a statement
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 51, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 90: ';' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 51, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 90: not a statement
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 51, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 90: ';' expected
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 51, Short.MAX_VALUE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 91: ')' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 91: not a statement
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 91: ';' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 93: ';' expected
    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 95: ')' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 95: not a statement
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 95: ';' expected
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:4 97: ';' expected
    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:5 00: ';' expected
    .addGap(243, 243, 243))
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:5 03: ';' expected
    .addContainerGap())
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:5 68: ')' expected
    private void jTextField1ActionPerformed(java.awt.event.ActionEv ent evt) {
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:6 13: ';' expected
    the sensor class
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:6 13: <identifier> expected
    the sensor class
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:6 21: illegal start of type
    import java.awt.Rectangle;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:6 21: <identifier> expected
    import java.awt.Rectangle;
    ^
    D:\JavaDevelopment\Testing\JavaForum\myform.java:6 73: reached end of file while parsing
    }
    0 error(s)
    Can you post code that compiles? Have it all in one file with all the classes. Only have the class with main() be public. No packages.

    Better would be to create a small program maybe 200 lines that demonstrates the problem. You've posted too much code. Most of it is probably not related to the problem.
    Last edited by Norm; 10-04-2008 at 06:28 PM.

  8. #8
    nobody is offline Member
    Join Date
    Oct 2008
    Posts
    5
    Rep Power
    0

    Default

    finally
    it works
    I do not know how :confused:

  9. #9
    hunterbdb is offline Member
    Join Date
    Oct 2008
    Posts
    48
    Rep Power
    0

Similar Threads

  1. mouse click alert
    By amir in forum AWT / Swing
    Replies: 1
    Last Post: 08-05-2008, 10:42 PM
  2. Replies: 21
    Last Post: 08-01-2008, 11:13 AM
  3. Problem in mouse click n repaint
    By Preethi in forum New To Java
    Replies: 4
    Last Post: 07-04-2008, 11:16 AM
  4. Repaint problem
    By swimberl in forum Java 2D
    Replies: 0
    Last Post: 01-06-2008, 03:28 AM
  5. Mouse Right click option not working in solaris and linux OS
    By dinesh kaushik in forum AWT / Swing
    Replies: 2
    Last Post: 11-21-2007, 04:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •