Results 1 to 2 of 2
  1. #1
    mumia55
    Guest
    eclipse (java animation issues)
    im having lots of problems in running this simple animation.
    the program just shows 1 frame, which is the last frame(i believe), on a windows computer, i can easily run this with eclipse, but on a mac, i've got always the same problems! HELP!

    import java.awt.geom.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;

    class chute extends JFrame implements MouseMotionListener{
    public JLabel x,y;
    public JPanel p1;
    public static void main(String[]args){
    JFrame janela=new chute();
    janela.show();
    }
    chute(){
    setTitle("chute");
    getContentPane().setLayout(new BorderLayout());
    setSize(300,300);
    setLocation(90,90);
    p1=new JPanel();
    p1.setLayout(new BorderLayout());
    x=new JLabel("x");
    y=new JLabel("y");
    p1.add(x,"North");
    p1.add(y,"South");
    getContentPane().addMouseMotionListener(this);
    getContentPane().add(p1,"South");

    }
    public void paint(Graphics g){
    int d=0;
    do{
    Graphics2D g2d = ( Graphics2D ) g;
    double i=0;
    do{
    super.paint(g);
    double x1=230-i;
    double x2=200;
    g2d.draw(new Line2D.Double(190,140,225,80));
    g2d.draw(new Line2D.Double(190,140,x1,200));
    g2d.fill(new Rectangle2D.Double(x1-30,x2-9,30,10));
    g.fillOval(100,160,40,40);
    i+=0.3;
    }while(i<62);
    i=0;
    double j=0;
    do{
    super.paint(g);
    double x1=198+i;
    double x2=200;
    g2d.draw(new Line2D.Double(190,140,225,80));
    g2d.draw(new Line2D.Double(190,140,x1,200));
    g2d.fill(new Rectangle2D.Double(x1-30,x2-9,30,10));
    g2d.fill(new Ellipse2D.Double(100-j,160-i,40,40));
    j+=0.5;
    i+=0.1;
    }while(i<30);
    d++;
    }while(d<2);
    }
    public void mouseMoved(MouseEvent e){
    x.setText("X: "+e.getX());
    y.setText("Y: "+e.getY());
    }
    public void mouseClicked(MouseEvent e){}
    public void mouseDragged(MouseEvent e){}
    public void mouseEntered(MouseEvent e){}
    public void mouseExited(MouseEvent e){}
    public void mousePressed(MouseEvent e){}
    public void mouseReleased(MouseEvent e){}
    //calculo de rotao
    /*public static double calculo1(double x,double y,double b){
    double tot=((Math.cos(b*3.14/180)*x)-(Math.sin(b*3.14/180)*y));
    return tot;
    }
    public static double calculo2(double x,double y,double b){
    double tot=0;
    tot=((Math.cos(b*3.14)*y)+(Math.sin(b*3.14/180)*x));
    return tot;
    }*/

    }

  2. #2


    Member Since
    Dec 24, 2006
    Location
    N. Ireland
    Posts
    901
    Specs:
    Mac Pro 2xQuad core 2.8GHZ
    Try posting this query on the java forums here -> http://forum.java.sun.com/index.jspa

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. OS X 10.5.8 Java Issues
    By iMultiTask in forum OS X - Operating System
    Replies: 0
    Last Post: 01-03-2012, 12:53 PM
  2. Eclipse and Java not working properly
    By walton12 in forum OS X - Operating System
    Replies: 6
    Last Post: 09-08-2011, 04:29 PM
  3. Java Performance Issues
    By Magstrike105 in forum OS X - Apps and Games
    Replies: 0
    Last Post: 03-30-2011, 05:53 PM
  4. Eclipse is not reconising the latest Java Update
    By lukegjpotter in forum OS X - Development and Darwin
    Replies: 5
    Last Post: 11-29-2010, 03:27 PM
  5. Eclipse-Java Help (Switcher)
    By chat19 in forum OS X - Apps and Games
    Replies: 3
    Last Post: 08-27-2008, 02:46 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
  •