1,678 Posted Topics
Re: It sounds like you are using netbeans. If you "select" the button so that it is orange, then double click it (or click on 'source'), you will see something that says jButton1ActionPerformed (or whatever the name of it is). Assuming you've already created whatever other window you want to open, … | |
Re: Bound it to the size of the table using modulus. Then you won't go out of bounds on the array. hash value % table size | |
Re: [url]http://www.daniweb.com/forums/announcement9-3.html[/url] And try reading that thread in addition to posting what errors you got. We're more than happy to help if we don't have to spend extra time doing things we shouldn't have to (like formatting your code and pasting it into our editor to run it and see what … | |
Re: "Made mine with eclipse instead of netbeans" What do you mean by that? I'd suggest you don't follow any tutorials meant to be used with netbeans if you're using Eclipse. The sun tutorials are good but if you look at all of the examples they provide, they provide the full … | |
I'm not sure what forum this fits into, if any, but the program itself is going to be written in Java (not that it matters much). My question is, what is the easiest software to use that I can create a drawing of a GUI with? The GUI I want … | |
Re: Try to parse the number as a double. If an exception is thrown clear the text field and request that the user input a valid decimal number. | |
Re: What is the error? Is it a logical error or a compiler error? | |
Re: You have an 8x8 array. All you need to go through that is two for loops. for row one through row eight for column one through column eight{ what piece is in the current index? } | |
Re: We don't give people code, we help them learn how to do it themselves. There isn't anything constructive that can come out of you posting that code for him. And the code you posted doesn't match the assignment by a long shot anyway. | |
Re: In general, using a for loop would shorten code like that. But since you don't have many lines of code anyway, using a for loop would not shorten it. Although it might be tricky to write in this case, so as an exercise, I'd recommend that you try it. | |
Re: Maybe I don't understand what a chat window is, but don't you have to connect to another machine in order to chat with someone? I don't see code involving Sockets anywhere. . ? | |
Re: And post your code in code tags in the future. You might want to look at the forum rules/stickies. | |
Re: I think it's mostly because his explanation doesn't make sense. Therefore the code doesn't make sense either. Lol. | |
Re: And definitely answer the question(s) Vernon posed. . what IS your experience level? What concepts do you know that he mentioned? | |
Re: You have to specify what you need help with. Frankly, nobody here wants to sort through your project description and your code to figure out why you're having trouble. If you want help you need to make the effort yourself. You should start by dividing your code into logical units … | |
Re: Absolute Java is a good beginner's book. It covers the concepts with simplicity and clarity, and goes in depth enough that you can explore the concepts further on your own without too much trouble. | |
Re: Static methods exist for the entire class -- although I'm not sure if this is technically correct, you can think of it as there being 'one copy' for the entire class. Static methods exist whether or not you create an Object of that class type, hence the reason why you … | |
Re: The method you were supposed to override is called contains, not contain. | |
Re: The first problem is that Java supports method overloading, meaning public void actionPerformed(ActionEvent e, pig ) is not the same as public void actionPerformed(ActionEvent e) So you should be getting an error saying that you didn't override ActionListener's actionPerformed method... ? Are you? | |
Re: In order for the actionPerformed method to be called, you need to use whateverThingItIs.addActionListener(Ghu); where Ghu is an instance of your Ghu class. So, for example, if you had a JButton called button and a Ghu called myGHU, it would have to say button.addActionListener(myGHU); . Your code is pretty hard … | |
Re: I'm pretty sure your problem is in this code segment: [CODE=Java]if(this.getFirstNode()==null) { this.setFirstNode(node); this.setLastNode(node); } else { Node temp; temp=this.getFirstNode(); while(temp.getNext()!=null){ temp=temp.getNext(); } temp.setNext(node); this.setLastNode(node); }[/CODE] Consider what happens the first time you create a Node. This code gets called, and the node sets itself as both the first and … | |
Re: Also, getting standard deviation is a multi-step process, is it not? Do you think it would be worthwhile to make different methods to do the separate parts? For example, standard deviation includes finding the mean, and I would think a method that finds the mean would be reusable and logically, … | |
Re: So you're saying to create a Rectangle, for example, that does not appear at all on his GUI? Then he can set the position of this invisible rectangle and see if the user clicks there with contains? | |
Re: Are you doing bit operations to count? Create a variable called nrParagraphs and increment it, nrParagraphs = nrParagraphs + 1, each time \n\n is read in. Alternatively, you could increment it every time a tab was read in. | |
Re: ^ That's a very good solution, I was just going to suggest going through the String in reverse order and printing the current character. | |
Re: I'm not too sure what you're asking but. . do you know what Applets are? This might be irrelevant, if so, feel free to ignore me. But since you've been getting no comments. . | |
Re: [url]http://java.sun.com/docs/books/tutorial/uiswing/[/url] Start there. Ask any questions you may have that can't be easily answered by reading. | |
Re: milesdriven = keyboard.nextInt(); I'm not exactly sure what Peter Budo is talking about (not that he's wrong, he probably thinks you were talking about a GUI). But the problem here is that you declared your variable as a double (which can hold decimals such as 32.5 etc), but you tried … | |
Re: Problems: 1. In the method pieceCaptured(), you never declared the variable "i", so you cannot use it as the array index. 2. You declared the arrays "whitePiece" and "blackPiece" inside a method (originalPlaces method), so the scope of those arrays is that method (which means that those arrays cannot be … | |
Re: No one is going to sort through all of that just to give you an explanation that is quite simple anyway. One thing you could do is check to see how many usernames your program currently has, and if it's 0, then display a screen allowing the user to create … | |
Re: To determine the size of the array: -Create a variable called size that represents the size the user wants the array to be -Ask the user what they want the size of each array to be -Initialize the arrays using the variable, size, that you created earlier. Once you get … | |
Re: The class with the buttons has to implement ActionListener. I see that you've implemented the actionPerformed method, which is the method that's called when the button is clicked, but you also have to declare your class as VendingMachine extends JFrame [B]implements ActionListener[/B]. In addition, you have to call the addActionListener … | |
Re: That's probably because you didn't import anything. In order to use the class you have to import it. I would guess the import is "import javax.swing.*;". You put imports above your class body. | |
Re: [url]http://www.extremeprogramming.org/[/url] [url]www.eclipse.org[/url] | |
Re: Make a loop in the main class that is like while(true) { -Accept incoming connection & spawn a new thread for it } There may be a better way but when I made a program to accept 4-5 connections at once, this worked well. I'm not sure if continuously sitting … | |
Re: I'd suggest reading about what static methods and static variables are, then you might start to understand why you are getting those errors, rather than guessing what you need to remove to get rid of the error. If you're using Eclipse it can be helpful because it has a lot … | |
Re: Every line starts with a String. So read it in. Then use a while loop to read in each integer on the line until -1 is the last integer you read in. Then repeat this process until you are at the end of the file. | |
Re: If you want help, then identify, specifically, what you are trying to do and why it does not work. We aren't going to scour your program for errors and give you answers. We will help you if you specify what you need help with. Start by dividing your payscale program … | |
Re: Out of curiosity, what are you using for this project (as far as GUI package)? Java 3d? | |
Re: Undoubtedly it's because you are attempting to read the file incorrectly (for example, you're using the String class' substring method, when you should be reading in a double). But you should use print statements and a catch statement to print out your exceptions/errors. ballXpos = Double.valueOf(line.substring(19)).doubleValue(); ^ doesn't work. | |
Re: Post your code. If you can't, we can't help | |
Re: This was the worst attempt at disguising homework I've ever seen. Lol. | |
Re: Make it synchronized to avoid memory inconsistency errors | |
Re: There's a way you can get around that. I think its by putting a backslash before the thing it thinks is an illegal escape character. So try \\d. | |
Re: Are you trying to update a file that the program is reading from? Or are you trying to change the code of a program that is running and then run it again? (Which would seem quite difficult to me). I don't think either of these are what you're trying to … | |
Re: In addition to what he said above, if at all possible, don't post your assignment explanation, just post whatever information is relevant to helping you solve your problem. If you've identified the problematic code, this means telling us what the code is supposed to be doing and telling us what … | |
Re: If that is how your search engine works, all you need to do is search through each String character by character, trying to match the current substring to your current search term. If you don't know any programming languages then you shouldn't be tackling this project, you should be learning … | |
Re: It would help if you declared main correctly, as public [B]static [/B]void Also, you might want to check that the variable 'i' doesn't go out of scope after the for loop. | |
Re: just do if currentMoneyValue < currentLowest{ currentLowest = currentMoneyValue; } | |
Re: int is 32 bits so it can only hold whatever value 32 bits can hold. And since you want to know if it's positive or negative, there goes one bit that would've gone towards calculation. So calculate that and there's your limit. |
The End.