Space Travel computer java applet

Posted on 1998-07-14
Last Modified: 2008-02-26
Given two to four stars arranged as neighbors compute the
density of the space precisely midway between them based on
the size and density and temperature of the stars and the
makeup of them and the distance between them. Inputs are all
the data for each star and the ouput is the density of the
hydrogen gas at the point between the stars and also the
strength of the gravity fields from the stars at the midpoint between them. Input for one star could be
the radius of the star, the temperature of the surface and
the core, the density of the star, the makeup of the core
which tells how evolved the star is. Also one additional
variable is the density of the hydrogen gas around the star
which feeds the star, and this densisty is regulated by
the gravity of the star and the star population of the
neighborhood going out about 1,000 light years or more and
all considering the distance of the star from the galaxy
Question by:johnh619
  • 4
  • 4

Expert Comment

ID: 1226347
johnh619, is this homework? Is it a joke?   :-)

Author Comment

ID: 1226348
No it is not homework or a joke. I want a java applet which I
can input info and then do the math and maybe eventually have
a graphical display. Can you help me? Really I am a novice. I have written one applet so far which I uploaded to my site and
is free. It is a double cache for netscape and IE. It switchs
the names around and leaves the fat file uneffected. I also
have another question in pending for a cache editor. These are
the two applets I am interesting in the most. I have a lot of java books but they just dont seem to answer all the questions.
Any help will be appreciated. I get confused when it comes to
choosing the method and figuring out if there is a method or a
method which I can facilitate; I figure I could learn the logic
and do it with logic if I spent enough time but the method might
be there already which would do it for me. So in my editor applet
I found that there were sort methods but I did not know which to
use and I thought there might be one to separate alpha and then
another for numberic. I just cant find the info. I did however
finally get this guys applet working which displays all the classes and lets you access Sun's site to get more info. He had
to change the memory allocation before it would load properly.
Finally though I did get it working with netscape.
is the url for his java explorer, if you have not seen it.
Sincerely JohnH

Accepted Solution

gadio earned 50 total points
ID: 1226349
Ok, heres a sample of (through what I undestand) your GUI can be. You need only to put the actual calculation into the last function. If you need more info - ask.

1. File

import java.applet.Applet;
import java.awt.*;

public class stars extends Applet {

    TextField fields[][];
    Checkbox stars[];
    TextField result;
    Button calculate;

     * Initializes the applet.  You never need to call this directly; it is
     * called automatically by the system once the applet is created.
    public void init() {
        fields = new TextField[4][6];
        stars = new Checkbox[4];

        setLayout( new BorderLayout());
        Panel mid = new Panel();
        mid.setLayout( new GridLayout( 5, 7 ));
        mid.add(new Label(""));
        mid.add(new Label("radius of star"));
        mid.add(new Label("surface temp."));
        mid.add(new Label("core temp."));
        mid.add(new Label("density"));
        mid.add(new Label("core makeup"));
        mid.add(new Label("hydrogen dens."));
        for( int star = 0; star < 4; star++ ) {
            mid.add( stars[star] = new Checkbox("Star "+(star+1),false) );
            for( int param = 0; param < 6; param++ ) {
                mid.add( fields[star][param] = new TextField(10) );
        Panel south = new Panel();
        Panel south_right = new Panel();
        south.setLayout(new GridLayout(1,2));
        south_right.add(new Label("result:"));
        south_right.add(result = new TextField(10));
        south.add(calculate = new Button("Calulate!"));
        add("North", new Label("Star calculations"));
        add("Center", mid);
        add("South", south);

     * Called to start the applet.  You never need to call this directly; it
     * is called when the applet's document is visited.
    public void start() {

     * Called to stop the applet.  This is called when the applet's document is
     * no longer on the screen.  It is guaranteed to be called before destroy()
     * is called.  You never need to call this method directly
    public void stop() {

     * Cleans up whatever resources are being held.  If the applet is active
     * it is stopped.
    public void destroy() {

    public boolean handleEvent( Event e ) {
        if( == calculate ) {
            return true;
        return false;


    private void doCalculations() {
        // Check which of the stars checkboxes is on and calculate accurdingly.
        // Put the result in the result textfield.
        result.setText("res"); // change this line.

Hope that helps you build your applet.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 1226350
Thank you gadio, if feel this is worth more than 50 points please
tell me, since I figure it does seem more to me than you. I only
have 85 points at present though. Please visit my website if
you wish: the subject space travel. is the main page.
I just finished compressing the graphics using the gif wizard
and it loads about twice as fast.
Really the subject of the applet is deeper than it seems on a
first glance level. The ramification of it is related to time
dilation. I wish to try to prove that though an astronaut may
only experience a few seconds of time distortion when they visit
the moon or mars, he may find extreme time dilation or contraction if he visit deep interstellar space. Therefore space
is only as euclidean as the space around one star. If you take
a group of stars then each creates its own euclidean space which
is not running at the same rate as its neighbor.

Author Comment

ID: 1226351
I forgot to put a grade. Sorry!

Expert Comment

ID: 1226352
johnh619, first I'd like to say that yes, I also feel that it worth a bit more but you problem is interesting so... :-)   Anyway, if you have any more Qs, or if youd like to add any graphic  representation of the problem later, you can address me with specific questions (I did a lot of graphics and animation in any languge).
Secondly, this is very interesting. I do know that the space is not euclidean, and I thought that it had to do with the effect of gravity fields of the stars (and singular points in black holes). Is this the base of your thesis or is it another idea? Are you doing this only as a theoretical expirimet or do you prove this through experimentation? How do you isolate deep space enviroment? I'm sorry if my Qs are simple and abstract. As an engeneer I took several courses in physics, but it is relatively only basic physics (I didn't get very deep on the theory of relativity).

Author Comment

ID: 1226353
I did not figure how to give you more points after the question
is closed yet

Expert Comment

ID: 1226354
You can issue an empty 'question' stating that its for me, and I'll answer it.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Spring Framework HTTPSession management 1 45
tomcat startup error 5 104
Which non-HTML GUI front end to use with Java? 3 24
Java basic valueOf question 1 29
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question