Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » windowbuilder: modify a java program with an interface(windowbuilder: modify a java program with an interface)
windowbuilder: modify a java program with an interface [message #1067969] Thu, 11 July 2013 13:21 Go to next message
federico panichi is currently offline federico panichiFriend
Messages: 1
Registered: July 2013
Junior Member
I have a java code that i want to modify whit a windowbuilder-eclipse interface.

What i want are windows in which the user can select the initial conditions:

import java.io.*;
import java.util.*;

class IC_masslessPlanetesimal {
  public static void main (String args[]) {  
    int iniziale, incremento, finale, no3D;  
    double a, b, tot, afin, ain, PMass, SunMass, Eccentricity, eccHill, M, n, Pi, Rap, E, ecc, RHillTest, Arg, Rapporto, RHill,Rplanet,TestMass,Rtest;
    no3D = 0;
    Rplanet=0.0001; 
    Rtest=0.0000002; 
    b=12.0; 
    a=10.0;
    ain=10.0; 
    afin=20.0;
    M=0.;
    Eccentricity=0.01; 
    iniziale = 1; 
    finale = 4000;
    Pi = Math.acos(-1);
    incremento = 1;
    PMass=9.0E-8;//la massa della terra=9e-10 
    TestMass=0.0; // 1/600 Planet mass
    SunMass=2.959139768995959E-04;


and this input must be pass to the follow for cycle and give the tp.in file as output. This is the shadow part of the program.

 try 
    {
      FileOutputStream file = new FileOutputStream("tp.in"); /*name of the new file*/
      PrintStream Output = new PrintStream(file);   
    Output.println(" 4000") ;

// INIZIO IL CICLO PER I PLANETESIMI 

     for (iniziale=1; iniziale <= finale;iniziale++)
            {

        eccHill = 0.00002;     //Eccentricity/Rapporto;

        Output.println(" "+iniziale+"1 ") ;             

        Random generator = new Random();

        ecc = Math.sqrt(-eccHill*Math.log(1-generator.nextDouble()));

        M = ((Math.random())*(Math.acos(-1)*2));

        E = M+(ecc-Math.pow(ecc,3)/8)*(Math.sin(M))+0.5*Math.pow(ecc,2)*(Math.sin(2*M))+(3/8)*Math.pow(ecc,3)*(Math.sin(3*M)); 

        Output.println(" "+ a*(Math.cos(E-ecc)) +" "+ a*(Math.sqrt(1-Math.pow(ecc,2)))*(Math.sin(E)) +" "+ no3D) ; //position 

            Arg = (SunMass+TestMass)/(Math.pow(a,3));

        n = Math.sqrt(Arg); // mean motion

        Output.println(" "+ -(n*a*Math.sin(E))/(1-ecc*Math.cos(E)) +" "+ (n*a*Math.sqrt(1-Math.pow(ecc,2))*Math.cos(E))/(1-ecc*Math.cos(E)) +" "+ no3D) ; //corotante

        tot = (afin-ain)/finale;

        a = a + tot*incremento;//semimajor axies: linear distribution of test particles: one particle per 0.0005 AU          
          } 
    }
    catch (IOException e) {
      System.out.println("Errore: " + e);
      System.exit(1);
    }
  } 
}

I have windowbuilder and i can do some stuff with it but i can't understand how to modify this code whit WB !

can someone help me please????
Re: windowbuilder: modify a java program with an interface [message #1068006 is a reply to message #1067969] Thu, 11 July 2013 15:58 Go to previous message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
This doesn't look like UI code, so I'm not sure you would want to modify it with WindowBuilder.

If you need help learning about Java UIs and how they work, this is not the correct forum. If you have a question that is specific to WB, feel free to ask it here. I don't see what this question has to do with WB though.
Previous Topic:Hard-coded text fields versus an array of text fields
Next Topic:Help getting started with Window Builder
Goto Forum:
  


Current Time: Mon Sep 23 17:59:43 GMT 2024

Powered by FUDForum. Page generated in 0.03542 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top