This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Applets and the fly likes How do i change this piece of code from a double to a stirng Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "How do i change this piece of code from a double to a stirng" Watch "How do i change this piece of code from a double to a stirng" New topic
Author

How do i change this piece of code from a double to a stirng

Kristen hulaj
Greenhorn

Joined: Jan 04, 2011
Posts: 1
I am doing this for a school project and would like the user to be able to enter in yes if they would like to view the instructions if they would like. i have the rest of the program working but right now it is just letting them enter a number and i can not find out how to let them input a word without errors.


public void actionPerformed(ActionEvent e)
{
Double name, instructions;
name = Double.parseDouble(nameTF.getText()); //We use the getText & setText methods to manipulate the data entered into those fields.
instructions = Double.parseDouble(instructionsTF.getText());


}
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41129
    
  45
That's a strange UI idea - entering "yes" for boolean decision. The proper way if for the user to click a checkbox, the label of which says "view instructions" or some such.


Ping & DNS - my free Android networking tools app
John Mejia
Greenhorn

Joined: Jul 29, 2008
Posts: 2
Try a string compare,
if( answer == "yes") then myNumber = 1 else myNumber = 0

Something like that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do i change this piece of code from a double to a stirng
 
Similar Threads
class or interface expected?
procedures and functions
String Tokenizer help
Passing data to methods
[HOMEWORK] Please need help with java project