New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

eclipse (java animation issues)


Post Reply New Thread Subscribe

 
Thread Tools
mumia55
Guest
 
Posts: n/a

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;
}*/

}
QUOTE Thanks
Del

 
Member Since: Dec 24, 2006
Location: N. Ireland
Posts: 901
Del has a spectacular aura about
Mac Specs: Mac Pro 2xQuad core 2.8GHZ

Del is offline
Try posting this query on the java forums here -> http://forum.java.sun.com/index.jspa
QUOTE Thanks

Post Reply New Thread Subscribe


« Mac Osx - Darwin/bsd | sorry for being ignorant but could someone tell me what DARWIN is »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Uninstalling/Reinstalling Java msb86 OS X - Operating System 6 11-09-2006 11:20 AM
Java update 1.4.1 is out rman OS X - Operating System 1 04-30-2006 01:05 PM
Java From Terminal jdgti OS X - Development and Darwin 10 03-26-2005 07:16 PM
Apple posts QuickTime for Java update 6.4 Murlyn Running Windows (or anything else) on your Mac 0 10-24-2003 11:06 AM
Apple Releases Java 1.4.1 Graphite Apple Rumors and Reports 5 03-10-2003 07:52 PM

All times are GMT -4. The time now is 03:16 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?