Magnet

Hi,Is there anyone who knows how I can do the java programming for a magnet? thanks!
[105 byte] By [mariaha] at [2007-11-26 15:05:23]
# 1
Huh?
CeciNEstPasUnProgrammeura at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 2
I would like to do a magnet that can attract for an exampel iron material..do you know how I can do that?:D
mariaha at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 3
Use a FileOutputStream to fill a hard disk with FF bytes only. All bits being magnetically set makes the disk become polarized, and you have a magnet... :p
CeciNEstPasUnProgrammeura at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 4
ok..? did you understand me? I would like to do a magnet in java, a animation..
mariaha at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 5
No! We have no friggin' idea what you are on about.
floundera at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 6

Use a graphics program of your choice to draw the magnet animation (good programs surely will give you a tutorial how to do animations). Then you can use, e.g., Java Swing to display it (see http://java.sun.com/docs/books/tutorial/ui/features/index.html for more help).

Or see CeciNEstPasUnProgrammeur answer below. :)

Message was edited by: stefan.schulz

stefan.schulza at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 7
> ok..? did you understand me? I would like to do a> magnet in java, a animation.. http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html http://www.developer.com/java/article.php/893471HTH
CeciNEstPasUnProgrammeura at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 8

Something like this?import java.util.Random;

public class Magnet {

private static final String[] mmm= {

"What's a girl like you doing in a place like this?",

"Come closer cutie",

"Hmmmmm ...",

"What's keeping you?",

"Waiting for Mister GoodBar?",

"I can't wait any longer",

"Here's daddy!"

};

private static final String[] eeeww= {

"Eeew! Get your nose out of there!",

"*Boink!*",

"*Clunk!*",

"You pervert!",

"Huh?!",

"You're into *what*?",

"Waidaminnit now!"

};

private static Random r= new Random(System.currentTimeMillis());

private static void m(String[] m) { System.out.println(m[r.nextInt(m.length)]); }

private void attract(Magnet other) {

m(mmm);

other.attract(this);

}

public static void main(String[] args) {

Magnet north= new Magnet();

Magnet south= new Magnet();

try {

north.attract(south);

}

catch (Error e) {

System.out.println();

m(eeeww);

}

}

}

kind regards,

Jos ;-)

JosAHa at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 9
That code is very attractive indeed.
floundera at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 10
Jos, youre freakin me out more than usual, lol.
TuringPesta at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 11
> That code is very attractive indeed.Thank you very much for the compliment; much appreciated ;-)kind regards,Jos
JosAHa at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 12
> Jos, youre freakin me out more than usual, lol.Well, it is all about magnets isn't it? ;-)kind regards,Jos (*clunk!* *ouch!*)
JosAHa at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 13
> "Eeew! Get your nose out of there!"Thats very scandalous.Let me guess... a foot guy? : )
TuringPesta at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 14
> > "Eeew! Get your nose out of there!"> > Thats very scandalous.> Let me guess... a foot guy? : )No, you pervert, just an ordinary nostrilogist. ;-)kind regards,Jos (some folks overhere ... )
JosAHa at 2007-7-8 8:55:10 > top of Java-index,Java Essentials,Java Programming...
# 15

> Hi,

>

> Is there anyone who knows how I can do the java

> programming for a magnet?

>

> thanks!

I'm not sure what's your problem! Are you familiar with the physics involved (Maxwell laws, electric fields, magnetic fields...) and want to "translate" them to java code or you just want to make an animation?

Manuel Leiria

manuel.leiriaa at 2007-7-8 8:55:11 > top of Java-index,Java Essentials,Java Programming...