Floats aren't very precise so I will probably switch the textboxes to a formatted text box and I still need to get the comboboxes active, but I got over the first hurdle without to much difficulty. ...
Type: Posts; User: JamesdTurnham
Floats aren't very precise so I will probably switch the textboxes to a formatted text box and I still need to get the comboboxes active, but I got over the first hurdle without to much difficulty. ...
Thanks. I saw that but couldn't figure out til you pointed it out. It works now, but I still have little tweaks to do.
/*
*
*
*/
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.*;
/*
*
*
*/
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
/*
*
*
*/
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.*;
I've redone my code and have tried to emulate the examples from the Oracle website but I still keep getting errors. Most of them are <identifier> expected. In this case the bolded part is where I...
How do I tell the program in the actionPerformed method to go through each JComboBox? Also if I put the action listener in the "construction box" I get compiling errors. When I add the...
I understand what your saying but the next question is how to implement it. I presume I assign each of the JComboBox options a defined variable and then use that for the calculations?
I sat around after I posted this and got it to work somewhat. I had a option message box appear and it would always give me a 0 or a 0.0
Also when I do the calculations I need to convert from...
I have the code for the JPanel and JComboBox and I want it so that when the user selects "Compact" from the combobox it the code then inputs 25 into a MPG variable and does it's calculations. The...
the listeners are in the code, but that's the part I don't know is what or how to get the listener to "hear" what is being selected. I presume I add the code to this part "public void...
I've got this part figured out from a previous assignment. What I haven't figured out is when I select say Bemidji to Darlington the coding to indicate that Bemidji was selected as the start and...
It's supposed to calculate the total miles traveled by cost per gallon either manually input into the text field or using the dropdown for vehicle type. In essence user selects drop down for vehicle...
Now if your wiling I need to code this so that when I select the various drop downs it will display my total costs. First I have to get the distance for all 6 drop down options and do all the...
JLabel Miles = new JLabel("Miles planning to travel");
JTextField distance = new JTextField(10);
JLabel Fuelcost = new JLabel("What is the price per gallon/litre?");
JTextField...
I believe you are referring to JTextField distance and fuelprice?
If i'm understanding your question correctly i've added them to the center.Panel and south.Panel and then added those panels to the layout in the container.
--- Update ---
For the text...
I am trying to create an applet that will show drop down boxes that display fuel types (have that working) along with 6 cities to start from and destinations (got those also working). I am to have 2...
I've gotten to the text fields are there but no button or anything else.
/* Chapter 7
*
*
*/
import java.awt.*;
import java.awt.event.*;
I am not getting any compiling errors except warnings but the layout is working like it should. Using my text book I can create a JFrame with the panel and text boxes and I can create the JFrame...
Quick question. Is it possilble to add JComboBoxes to this or should I rewrite the whole thing? The book gives an example of a content pane with the ComboBoxes but they are doing different things...
Ok. Thanks for all the tips, i've got it all figured out.
I've done that and also turned the getFuelcost() into a method but now it's saying I can't have two (ints) for the method. I've already declared what the variables are so i'm puzzled why this isn't...
I've tried removing that and I still get the same error, the cursor though is right after fuelcost with the same error that it's expecting an identifier.
Line 83 is the line that i've bolded. Not sure about the semicolon's since they seem to be all correct unless i'm missing the obvious.
Nice pic of Walter by the way.