Page 1 of 1

Java Help

Posted: Sun Aug 05, 2012 12:10 pm
by Mr.Wilson
I am trying to learn the Java language and in doing so I am trying to design a "Truck Drivers Log Book."
I have a comprehensive book on Java but it says nothing about charting.
I am trying to design the interface to have a time line chart with four "rows" .
One of coarse for each of the duty status and when the user clicks a starting point(ex 915 am) it should draw a line from starting point (915am to) next click on the time line (ex1130 am) it also must be able to draw a line from one row to another.
I probably could have explained it better. If anyone has any questions about the requested design I would be glad to answer.

Any help with this will be greatly appreciated

Re: Java Help

Posted: Sun Aug 05, 2012 12:49 pm
by Shim
are you just started learning java ?? or you need help ???

Re: Java Help

Posted: Mon Aug 06, 2012 1:45 am
by Mr.Wilson
I am a college student majoring in programming and I have had the java class.
I am currently working on this project and am seeking help with the user interface. I plan to have the programs GUI represent that of a log page however after planning and research I am still unsure how to begin to get Java to draw the chart part of the interface If it is even possible in a windowed application

The following is some of the planning done so far. I know this is a swing app but I was using this to layout of the logic
Again this is just logic and not intended to be the program nor finished

Thanks agian
Code: Select all
import javax.swing.JOptionPane;

public class LogBookSwing
{
	public static void main(String[] args)
	{
		// declare and construct varibles
		String stCity, dvrId, totalMiles, milesDriven, eCity, truckId, trlrId,stState, eState, origin, destination, bol;

		double  hrsWrkd, mDriven, hrsAva, totAvaHrs ;

		// print prompts and get input
		System.out.println("\t\tSue Wilson's Log Book");

		dvrId = JOptionPane.showInputDialog(null, "Please Enter Your Driver Id To Begin.");
		stCity = JOptionPane.showInputDialog(null, "Please Enter Your City of Origin.");
		stState = JOptionPane.showInputDialog(null, "Please Enter Your State of Origin.");
		eCity = JOptionPane.showInputDialog(null, "Please Enter The Intended Destination City.");
		eState = JOptionPane.showInputDialog(null, "Please Enter The Intended Destination State.");
		truckId = JOptionPane.showInputDialog(null, "Please Enter Truck Id.");
		trlrId = JOptionPane.showInputDialog(null, "Please Enter Trailer Id.");

		milesDriven = JOptionPane.showInputDialog(null, "Please Enter Total Miles DRIVEN By You.");
		mDriven = Integer.parseInt(milesDriven);

		totalMiles = JOptionPane.showInputDialog(null, "Please Enter Total Miles Today.");
		mDriven = Integer.parseInt(milesDriven);




		// calculations uses max avg speed for truck divided by input miles driven
		hrsWrkd = mDriven / 60;
		hrsAva = 11 - hrsWrkd;
		totAvaHrs = 70 - hrsAva;
		origin = stCity + " " + stState;
		destination = eCity + " " + eState;


		//output
		JOptionPane.showConfirmDialog(null, "You Will Be Departing From " + origin +" "+" In Truck " + truckId + " With Trailer "+ trlrId +" Bound For "+ destination +"." + " Correct ?");
		JOptionPane.showMessageDialog(null, "Hours Spent Driving " + hrsWrkd + "hrs.");
		JOptionPane.showMessageDialog(null, "Hours Currently Available " + hrsAva + "hrs.");
		JOptionPane.showMessageDialog(null, "Total Hours Available Are " + totAvaHrs + "hrs.");




	}
}