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.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;
    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

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

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


     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);

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: 971
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:WindowBuilder encountered unexpected internal error
Goto Forum:

Current Time: Fri Apr 20 22:37:55 GMT 2018

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

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