1,678 Posted Topics
Re: Is this really about kids being banned from playing games? Or is it about regulating which games can and cannot be sold in the U.S.? I could care less what games kids can buy. And their parents can buy the games for them, if they so choose. | |
Re: [TEX][code=Java]Your code goes here[/code][/TEX] Do that. Clicking the "#" button will do it automatically for you. | |
Re: This should have been posted using a normal thread. Only working example code should be posted as code snippets. | |
Re: My first guess would be because that code is JQuery and this is the Java forum, whereas JQuery is written in Javascript. | |
Re: This is incredibly insulting. Do you honestly think we are this stupid? Please, do yourself a favor and don't post here again. Also, regardless of my level of rust, I'm sure I could handle this joke of a program. You seriously can't do it yourself? | |
Re: I don't understand the algorithm you just posted.. do you need Java help or just help with your algorithm, or both? If you only need help with the algorithm then 'Computer Science' would be a better forum for this question IMO. Either way, if nobody else replies soon, maybe you … | |
Re: Agreed - I'm pretty sure Applets use the init method to start, not main. Your "Applet" also contains standard Java code that would print to the console, whereas it should get input via a GUI. And use JApplet not Applet [url]http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html[/url] | |
Re: "this" refers to whatever Object called the method you are currently in. If the method that you are currently in is a constructor method, then "this" refers to the Object that you are creating. | |
Re: [CODE] public class ContinueTest { /** * @param args the command line arguments */ public static void main(String[] args) { for(int count =1; count <= 10; count ++) { if(count != 5) System.out.printf("%d", count); } System.out.println("\nUsed continue to skip printing 5"); } } [/CODE] .. You can also use System.out.print(count); … | |
Re: It's legal to overload any method anywhere, but it probably won't do what you want. What you're supposed to do is [I]override[/I] the run method. See [URL="http://java.sun.com/docs/books/tutorial/essential/concurrency/runthread.html"]here[/URL] | |
Re: [CODE] import java.util.Scanner; import java.util.InputMismatchException; public class TourPrices { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int tourPrice = 0; boolean ok = false; do { try { System.out.println("Enter a score"); tourPrice = scan.nextInt(); if(tourPrice >= 29.95 && tourPrice <= 249.99) ok = true; } catch(InputMismatchException … | |
Re: System.exit(0); [url]http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html[/url] | |
I was going to post this in the linux/unix board, but there is no 'start new thread' button. Why is that? Anyway, I'm going through a ton of steps to apply a patch file. Everything in the patch file seems to apply seamlessly, with one exception. My patch file is … | |
Re: If you dispose a parent component you also automatically are disposing of all the child components. Presumably you're calling dispose() on the outer JFrame, which is causing the inner one to disappear? If you want to remove the JFrame, you can just call [ICODE]firstJframe.remove(otherJFrame);[/ICODE] and it will be removed automatically. … | |
Re: You declared an array of "n" College Objects, but you did not initialize it. You must create a new Object at each index before you can call methods on it. Also, post a regular thread in the future, not a code snippet. | |
Re: Use methods. Your example and explanation are convoluted and I can't give more specific advice, but to "do something" under certain conditions (i.e. in a control structure such as a for loop, if statement, etc) you can call a method. | |
Re: Post using code tags in the future. It's the little button that looks like a # sign on the reply box. Put your code inbetween the brackets that show up after you click it. Anyway, you should also give more information here. Can you not read from the file, or … | |
Re: I don't think the act of opening or closing this thread has anything to do with Dave either way. edit: But of course I do agree that it should be treated/closed under the same circumstances as any other thread. | |
Re: Ron, I agree with your point that the president's statement was foolish. The president implies that information is a distraction and a diversion. He ignores the key point that the devices he lists (and others that he alludes to) are a means to spread information, and do not control how … | |
Re: Jake.. The OP was obviously talking about Linux included when he said Unix. [QUOTE]- Indoctrinating a whole generation of IT workers with the "windows way" to the exclusion of all else. Take a look at the curriculum of your local tech certification centers, community colleges, and vocational tech schools. Look … | |
Re: Be clear with your questions, instanceof is a specific java statement that can be used (for example) in the following way: [CODE] if (x instanceof y){ System.out.println("Cool"); } else System.out.println("No runtime error or compiler error here."); [/CODE] And btw, I did understand your question after I read the quote, I'm … | |
Re: A device called HiHe that parses posts from [URL="http://www.programmingforums.org/thread26709.html"]this site[/URL] and reposts the barely reworded content on Daniweb. | |
Re: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html[/url] | |
Re: [QUOTE=jwenting;1207965]validation rules are invalid, solution rejected.[/QUOTE] Yeah, but the validation rules for email addresses are quite complicated and I doubt the OP has made up the rules posted above, they are created by his teacher. | |
Re: "3. Apple has very bright people and extremely good lawyers that are well-paid out of Apple's 40 Billion Dollar Cash Pile. Any antitrust allegation is just BALONEY. Move on." That doesn't seem to be what the Department of Justice or the FTC think. Why would I give your opinion more … | |
Re: Read on google and figure this out yourself. If you know how to pass by reference, declare a function, pass by value, subtract two ints, and use if statements to compare ints, then you can definitely solve this problem. If you can't do any of those things then read any … | |
Re: You can declare and initialize your arrays all at once like this: [CODE]int[] jobs = new int[4];[/CODE] When you read input using Scanner, you should ensure that your program does not crash by using: [CODE]if (keyboard.hasNextInt()){ myInt = keyboard.nextInt(); }[/CODE] Calling Arrays.sort() on line 24 in your code doesn't do … | |
Re: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/table.html[/url] | |
Re: [QUOTE=luvthug;1209394]What I wan to acheive is. the that is typed in aswell as it should display on screen and should be written to a file and each string should be on a seprate line. So * the asterik terminates the program but thats the only thing which appears in the … | |
Re: This problem is teaching you about method overriding and how it is an important part of Inheritance. For example, your baseball's play() method should print "Playing America's past time" to the user, the Basketball class's play() method could print out "Playing Basketball", etc. The same goes for the bounce() method … | |
Re: As amusing and ironic as I find this, I don't think "500 Internal Server Error Servlet processing error java.lang.NullPointerException at com.thruport.jbird.core.JBirdFilterChain.doFilter(JBirdFilterChain.java:36) at com.thruport.jbird.core.JBirdContext.processRequest(JBirdContext.java:1989) at com.thruport.jbird.container.JBirdRequestHandler.execute(JBirdRequestHandler.java:159) at com.thruport.jbird.server.TcpConnectionHandler.run(TcpConnectionHandler.java:56) at java.lang.Thread.run(Thread.java:619)" Should be at the top of the Java forum. | |
Re: Have you seen [URL="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130.java?view=co"]this article[/URL]? Keep in mind that if you run your "long running task" on the event thread then that is probably why the cursor is not changing... If that isn't helpful, sorry, but you'll probably have a lot more luck asking this on an Eclipse RCP specific … | |
Re: You have the words "end if statement" in three different places so that isn't very helpful. You've stated that the error is at line 160 but you only posted 130 lines of code. Post your errors and be specific about which lines of code they are at. | |
Re: What happens if there is a "*" at row 0? Then wouldn't your code attempt to check row "-1", which doesn't exist? Similarly, if a row is at the end of the array, it looks like your code attempts to check ARRAY_END + 1, which is an index that doesn't … | |
Re: As long as it gets the point across I could care less if Dani calls it No-No's ![]() | |
Re: What Object does paint() get called on? I see no GUI code... | |
Re: Then remove or poll() the queue until you've looked at every element. Compare the smallest element found thus far to the current element, and set the smallest to the current if you find a smaller one. | |
Re: The real solution to this problem would be to use a boolean variable hasBeenUsed and set it to false initially. Then once your array is used, set it to true. That way you can check the variable later to see if it was ever used. | |
Re: [QUOTE=lashbandi;1193208]I am suppose to write a method that checks whether a string is a valid password. The password rules are: 1.) A password must have atleast 8 characters 2.) A password consists of only letters and digits 3.) A password must containt 2 digits I need to write a test … | |
Re: Threads are never deleted for database reasons. It would also help if, in the future, you mark threads solved once you are done with them, and post what you did to fix the code, that way people don't come in with the intention of helping you solve your problem and … | |
Re: As far as I know, you should be extending JApplet, not Applet, and if you are expecting this to run in a web environment, your teacher should not have to do anything other than going to the correct website with a Java enabled web browser. You'd have to embed the … | |
Re: Then you either have to call Piggy.SampleB() or from within the SampleA() method, you have to call SampleB(). Btw, methods should be named in camelcase starting with a lowercase letter: nameMethodsLikeThis() and Objects should be named the same way (although Objects, preferably, should have pretty short names). | |
Re: What are you trying to accomplish? You can create a JPanel and show it dynamically by adding it to a JFrame or to another JPanel. | |
Re: Moutanna's suggestion was a good one; break in this case would be a good idea. If you don't want to use break, though, you can use a for loop and make one of the conditions a boolean. Set that boolean to true once you find the value so it will … | |
Re: In addition to what moutanna said, you should be wary of bad user input. For example, before you call nextDouble() you should verify that there is actually a double present in the input by calling hasNextDouble(), which returns true if there is a double that can be read in. Oh, … | |
Re: [CODE] while ( a != 0) { total += a; }[/CODE] This bit of code doesn't make sense. "a" is an array of doubles. So when you say "a", "a" is a reference/memory address. If you want to access the [I]value [/I] stored in "a" you have to change the … | |
Re: You have to create a new Object of that classtype i.e. dataClass dc = new dataClass(); | |
Re: You never initialized the instance variable "lbl" which is declared on line 14 above. At line 21, you declared and initialized a [I]different[/I] variable that is also called "lbl". But inside your actionPerformed method, the "lbl" that it is trying to call setText() on is the "lbl" that you declared … |
The End.