3,927 Posted Topics
Re: The switch should work just fine. Make sure that your game loop is checking it appropriately and that you haven't defined the RUNNING and PAUSED constants to be the same value (by copy-paste oversight or whatever). | |
Re: Look at the api doc for indexOf(). It returns -1 when the string is not found in the target string. You are searching for a comma in a name that does not contain a comma in your driver class. The test name in your class does have the comma so … | |
![]() | Re: Use a [URL="http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html"]BufferedReader[/URL] with the readLine() method. You can either skip lines as you read them, or place each line into an ArrayList, and process them as needed. |
Re: If you use [URL="http://java.sun.com/javase/6/docs/api/java/io/BufferedWriter.html"]BufferedWriter[/URL], which can be wrapped around a FileWriter, you can use newLine(). If you need to write the OS-specific line separator yourself, use System.getProperty("line.separator"). | |
Re: You cannot declare methods inside other methods like that. Move it out to the class level. | |
Re: [url]http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html[/url] and [url]http://java.sun.com/docs/books/tutorial/essential/environment/paths.html[/url] | |
Re: Well, you are asking someone to teach you how to do your project, which amounts to the exact same thing. Make some effort. | |
Re: [QUOTE=EnderX;536199]I would think everyone would qualify as 'food-addicted'; I don't know many people who can go for very long without eating something.[/QUOTE] Yes, the withdrawal symptoms are rather severe. | |
Re: Yes, for your purposes a simple array of String would be all that was needed.[code]import java.io.*; public class Problem2 { private static BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) ); public static void main(String[] arguments) throws IOException { System.out.println("Welcome. How many names do you wish to enter?"); String … | |
Re: Hard to say really, especially not seeing your custom wrapper code. I have only used JOGL with Swing/AWT, so I'm not familiar with any of the issues related to its use with SWT, but since you say the code works fine without your abstractions I would look to those first … | |
Re: No, your question is not clear at all. Please try to rephrase it. | |
Re: For one thing, this [code]public class Point extends Pair { super(xx,yy);[/code] is not a valid constructor. Re-examine your class notes on basic class structure. | |
Re: Take a look at the NeHe OpenGL tutorials found here: [url]http://nehe.gamedev.net/[/url] It should get you up to speed pretty quickly on the basics. You certainly don't need to use Linux unless you just happen to want to. | |
Re: Read through the sticky thread at the top of this forum. There are a lot of references there. I've heard the "Head First Java" book is very good, as well as "Core Java 2 vol.1/2". | |
Re: Well, you do not call the printCapitalized() method anywhere in your main method, so it's not going to do anything until you call it. | |
Re: You're also trying to declare your methods inside that incorrect constructor. You cannot declare methods within methods. | |
Re: You would need to post the paintSprite() method code, as that is the one making the calls into the graphics methods that are overflowing the stack. | |
Re: You forgot one: Crack Addict They wouldn't win the poll though. | |
Re: Java has an api for working with images. There is no need to read raw file values. Take a look at some of the examples here: [url]http://www.exampledepot.com/egs/java.awt.image/pkg.html[/url] Specifically you will probably want to work with a BufferedImage: [url]http://www.exampledepot.com/egs/java.awt.image/ImagePixel.html[/url] | |
Re: Well, you know that the rank will be 1 or 2 characters. The suit will always be a single character at the end. Using the substring() and length() methods of String, you should be able to separate the string easily into the two portions that you need. | |
Re: [QUOTE=Estella;519853][B]"The fear of the LORD is the beginning of knowledge: but fools despise wisdom and instruction." Proverbs 1 : 7[/B][/QUOTE] I would argue that fools mistake religion for knowledge and wisdom. | |
Re: No, you do exactly what the assignment indicates: Use an Iterator (look it up in the API) to walk through each List element and append the String from each element's toString() value to your text area. | |
| |
Re: You're definitely going to need to do more work on it then what you posted if you expect to receive any help at all. | |
Re: You could add the file names to a [URL="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html"]HashSet[/URL] as you download them. The add() method will return false if the set already contains the item, at which point you could alter the filename, add it to the set and then write it to the zip stream. | |
Re: You don't show how you are attaching the listeners, but yes, it's a focus issue. The easiest thing for you to do is define the actions for those listeners as small inner classes that extend [URL="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractAction.html"]AbstractAction[/URL]. That will allow the button and key listeners to share the code for that … | |
Re: About the only thing that comes to mind is to use System.out.print() (not println) to print the file name and then append periods after it until it's done, and then println "complete" and move along to the next file. There isn't really a mechanism to overwrite a line of output … | |
Re: For this you would use a [URL="http://java.sun.com/javase/6/docs/api/java/lang/Process.html"]Process[/URL] which can be created via [URL="http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String)"]Runtime.getRuntime().exec(java.lang.String)[/URL] or [URL="http://java.sun.com/javase/6/docs/api/java/lang/ProcessBuilder.html"]ProcessBuilder[/URL]. Process has methods to obtain input/output/error streams as well if needed. | |
Re: Well, start by writing a class that represents a gas bill I guess. You already listed two properties it should contain. Add more as needed. Beyond that, you haven't given enough information to work with. | |
Re: It's merely a number that identifies that build (compilation) of the software. Each build incorporates one or more changes to that software and numbering them allows you to keep track of those changes incrementally and also to roll back if necessary. It's similar to a fine-grained version number in some … | |
| |
Re: [QUOTE=edchabz;532656]I have a good idea what I am supposed to put but I can't seem to get it right. I have two different files, Server.java and Client.java. I want Client.java to call a method in Server.java. This is what I have figured out so far. public class Client{ public static … | |
Re: [QUOTE=vegaseat;508321]"SuPeRcAlIfRaGiLiStIcExPiAlIdOcIoUs" works well for me as a password.[/QUOTE] Not exactly what I want to have to type in the morning to unlock my workstation ;) | |
It's not hard to see congressional strings being pulled for this one: [url]http://arstechnica.com/news.ars/post/20080207-controversial-college-funding-bill-passedp2p-proviso-intact.html[/url] [QUOTE]COAA makes a host of changes to the higher education landscape in the US, but for our purposes, the most interesting was the requirement that schools make plans to offer some form of legal alternative to P2P … | |
Re: You might want to look into whether you can use [URL="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html"]Callable[/URL] for your task instead of Runnable. Callable throws Exception and returns a result. Using that, in conjunction with Future and an Executor perhaps, would be an option. Since you seem to have a lot of questions on threading lately, … | |
Re: [QUOTE=iamthwee;528847]@Bennet: During your college years there will be no other time in your life where you will have a continuous flow of chicks. Make the most of it. Carpe Diem.[/QUOTE] It would be "Carpe dame" in that case I guess? | |
Re: Of course there is an error - you haven't written the method alreadyExists() yet. That is exactly what javaAddict was trying to tell you in the first place. You can't call methods that you haven't written yet. Additionally, if you would actually read the API for HashMap, which Phaelex suggested, … | |
Re: Well, it took about 2 seconds to find with Google: [url]http://en.wikipedia.org/wiki/Pi#Calculating_.CF.80[/url] | |
Re: In all likelihood, yes, you'll have Java at some point in your CS courses. Visual Basic is a lot less likely. | |
Re: Regular expressions, Scanner, or String.split() will all work for that. | |
Re: Sure, you can use length. The parsing problem is that you are using the indexOf(",") value to start, when you should use indexOf(",")+1. You are getting the comma and it won't parse that. | |
Re: You cannot place those assignments ("card[0] ="SPADES Ace";") directly in the class body like that. Additionally, you are not using the template that was provided. You have declared card[] as an array of Deck, when the assignment declares deck[] an array of Card. It also indicates that in the constructor, … | |
Re: Try using a [URL="http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html"]BufferedReader[/URL] with the readLine() method.[code]String line=null; while ( (line=reader.readLine()) != null){ // do stuff }[/code] | |
Re: It doesn't show because you reset the layout on the content pane before you add the text area panel. You can't just change the layout on the container like that midway through adding components. If you need to have separately laid out sections, create panels for those sections and place … | |
Re: You have leftSide() and rightSide() methods declared within the body of insertMoney(). Check your brackets. | |
Re: Your increment statement is after the return statements. There is no way that code can be reached, which is I'm sure what the compiler is telling you. | |
Re: [QUOTE=MidiMagic;518362]No, with high taxes, you can pick only one.[/QUOTE] Ah yes, gotta find a way to get a jab in about taxes of course. :yawn: | |
Re: UML is great!... for selling books and useless corporate OO design seminars... | |
Re: Foot to rear can be very effective communication. | |
Re: Your intent is a little bit vague here. You need to wait for a string before actually doing anything and you also want to keep track of the time between two entries? In the first case, why not just wait for the input before starting the thread and for the … |
The End.