Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Converting a Desktop App to Android

  1. #1
    Junior Member ElJefe's Avatar
    Join Date
    Oct 2014
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Converting a Desktop App to Android

    Good Afternoon,
    So yesterday I realized that I might have been completely vague and left a lot for misinterpretation. I will describe my program, show the code and then try to give an example of that I am trying to accomplish.

    My Program:
    I am trying to make an interactive program to get information on angles from the user (I am an artillery Training Instructor on Camp Pendleton and am trying to make some peoples lives much safer and easier). This program grabs numbers, either in (int) form or (double) form, I have created the formulas to convert their information into an Angle. After 5 difference calculation I finalize their equation by adding up all 5 angles to give them (the user) a very important and specific number to apply to their safety measurements.

    My Code: (and critiques to syntax or format will be very helpful, I am very new to java)

    /* This is going to be a skeleton program to produce
    * an application for calculating XO's Min QE within
    * a windows (toughbook) for Artillerymen or android platform smartphone/tablet
    * Written by: Sgt Morgan, Robert
    * Date Start: Oct 7, 2014    Date Finish:
    * Copywrite will be pending until finished
    */
     
    import java.util.*;
     
    public class XoMinQe 
    {	
    	public static void main(String[] args) 
    	{
     
    		// ****Greeting and PREP****
    		System.out.print("Together we are going to ");
    		System.out.println("calculate XO's Min QE.\n");
     
    		// going to have user press "enter"
    		Scanner keyIn = new Scanner(System.in);
    		System.out.println("Press the ENTER key to continue");
    		keyIn.nextLine();
     
    			// ****ANGLE 1****
    			// Declaring Angle 1 from user
    			double angle1;
     
    			// going to have user input followed by "enter"
    			Scanner in = new Scanner(System.in);
     
    			// This is going to get the total for Angle 1
    			System.out.print("Enter the Site to Crest information from the");
    			stem.out.println(" Section Chief Report and press Enter.");
     
    			// Applying value from user to angleOne variable
    			angle1 = in.nextDouble();
     
    			// Angle 1 round up *if required*
    			System.out.println("The Value of Angle 1 is " + (int) Math.ceil(angle1));
    		        int angleOne = (int) Math.ceil(angle1);
     
    			System.out.println("\n");   //I do not know how to get proper spacing any other way
     
    			  // ****ANGLE 2****
    			  // Getting the Vertical Clearance *Unarmed/Armed VT* from User
    			  System.out.print("What is the vertical clearance for your firing area?\n");
     
    			  // Applying value from user to vertical clearance variable
    			  int verticalClearance = in.nextInt();
     
    			  // Getting the PCR value from user
    			  System.out.print("\n What is the Piece to Crest Range (PCR) for that weapon?\n");
    			  System.out.println("*Hint* You can get it from the Section Chief Report");
     
    			  // Applying PCR to variable
    			  double pieceToCrestRange = in.nextDouble();
     
    			  // Expressing PCR in thousandth
    			  double pcrExpression = (pieceToCrestRange / 1000);
     
    			  // Going to calculate vertclear/(pcr/1000)
    			  double angle2 = (verticalClearance / pcrExpression) * 1.0186;
     
    			  // Rounding up Angle 2 to final number
    			  System.out.println("\n The Value of Angle 2 is "+ (int) Math.ceil(angle2));
    			  int angleTwo = (int) Math.ceil(angle2);
     
    			    // ****ANGLE 3****
    			    // Getting the Site Factor = Angle 1 + Angle 2
    			    int siteFactor = angleOne + angleTwo;
     
    			    // Declaring variable for Complementary Angle
    			    System.out.println("\n Enter the Complementary Angle from the TFT, Table G.\n");
    			    double compAngle = in.nextDouble();
     
    			    // Calculating for Angle 3
    			    double angle3 = (siteFactor * compAngle);
     
    			    // Rounding up Angle 3 for final number
    			    System.out.println("The Value of Angle 3 is " + (int) Math.ceil(angle3));
    			    int angleThree = (int) Math.ceil(angle3);
     
    			    System.out.println("\n");      //Same issue here with formatting
     
    			    // ****ANGLE 4****
    			    // This is going to get value of Angle 4 from user
    			    System.out.println("What is the TFT Value for that Charge and PCR (TFT, Table F, Col. 2)?\n");
    				      double tftValue = in.nextDouble();
     
    	       		    // Rounding up Angle 4 for final number
    	       		    int angleFour = (int) Math.ceil(tftValue);
    		 	    System.out.println("The Value of Angle 4 is " + angleFour);
     
    				// ****Angle 5****
    				// This is going to get the value for number of forks
    				System.out.println("\n Enter the number of Forks (TFT, Table F)\n");
    		                int forks = in.nextInt();
     
    				// Calculating for final result of Angle 5
    				int angleFive = (forks * 2);
    				System.out.println("The Value of Angle 5 is " + angleFive);
     
    				// Calculating End MIN QE for Gun ___
    				int minQE = (angleOne + angleTwo + angleThree + angleFour + angleFive);
     
    		                // ****MIN QE****
    				System.out.println("\n The MIN QE for this Gun is " + minQE);
     
    	}
     
     
    }

    Basic Concept of Look and Feel:
    What I was hoping to learn was how to take this code and implement it into a user friendly which will expand as the answers are generated.

    EXAMPLE:
    Name: XO Min QE Calculator

    My questions show up here from the above statements.(in the code)

    Text Box------------------------- (Calculate)<---- Button

    The Value of Angle 1 is ______

    Each time the press a button a new "the vale of angle # _____ shows up extending the window until all 5 angles are computer and then finally showing the user their final product on the bottom of all the calculated data.
    If anyone can help, I would appreciate it, if you cant or there is no way to do this please let me know. I am willing to clean up this code as much as possible as well. Any and all "lessons to be learned" will be greatly appreciated
    *this is no homework, this is my own project to help my fellow Marines and Artillerymen alike.

    Thank you


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: How to take my java application and run it with a GUI instead of the IDE

    Please do not start multiple threads on the same topic. If you decide the first thread needs to morph into something else, explain it and continue on. If you believe the original thread should die as it is so that you can take a Mulligan, then PM a mod to close the original with a link to the new thread.

    Spreading the same topic around in multiple locations just creates confusion - and sometimes hate (well, dislike) and discontent.

    Thanks.

    After some discussion it was decided to leave the above post separate from the original thread. Posting nearly the same in both threads created the confusion, but note that this thread is accurately described by the title while the other is focused on learning how to build a desktop GUI.

    In a PM, I advised the OP to learn the two technologies one at a time.

Similar Threads

  1. desktop app
    By donzii in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 1st, 2012, 08:48 PM
  2. Converting a Java App to an Applet(with no GUI)
    By davidvee in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 2nd, 2012, 12:40 PM
  3. Replies: 6
    Last Post: April 9th, 2012, 02:41 PM
  4. Java web app, Saving to desktop?
    By Java Programmer in forum What's Wrong With My Code?
    Replies: 14
    Last Post: January 21st, 2012, 04:41 PM
  5. Convert Desktop app into Applet
    By Nesh108 in forum Java Theory & Questions
    Replies: 2
    Last Post: October 27th, 2011, 08:11 AM