527 Posted Topics
Re: I think it has something to do with the way the stream works-- if you call the method nextInt it will return the value on the line and attempt to the next line of code. I'm almost certain that because the type returned was not the type that should be … | |
Re: Have you tried taking out the (void) in the constructor for Form1 and instead using Form1() ? I didn't know the compiler would accept non-pointer void arguments... it may be confusing it with a possible value? It's worth looking into.. | |
The error is listed in the title and then commented in main (last comment). The program runs but once it encounters the bool expression I overloaded, it seems as if the program pauses. I have a feeling it's a stack overload due to the way my function operates, but I … | |
Re: [QUOTE=marcosjp;622925]Hello! As a college assignment, I'm finishing a small applet that communicates with a MySQL database (through a Java server via RMI - all this is part of the assignment). It's doing all it should except for one thing: in one of the tabs I included a JTable that lists … | |
Re: term = static_cast< double >((numerator/denominator)); is evaluating the double after doing int division within the cast. Try-- term = static_cast< double >(numerator)/denominator; | |
Re: For your first question, why not make a class that extends from the vector class and overload the binary operator in your extended class to do the scalar-to-vector multiplication you want? Also, because your cycle method in your base class isn't virtual, it will call its own method of cycle, … | |
Re: A Frame is a component, and can accept other components. Think of components as chunks of data that can store data of each other... Here's the extension of JFrame java.lang.Object extended by java.awt.Component extended by java.awt.Container extended by java.awt.Window extended by java.awt.Frame extended by javax.swing.JFrame JFrame IS-A component and IS-A … | |
Re: my first post! sorry to post in an old thread, but i have a question related to this. my situation is this: i want to make a paint-like program for a project in class, with "quick select colors," an array of colors, and an array of buttons (with only background … | |
Re: This looks pretty straightforward... Basically you're using a pattern. Think of how you can use iteration (or recursion) to add the correct exponent and value to each section of the polynomial so you'll, only need a small block of code. | |
Re: Syntax for an array is simple-- [code=Java] ClassName_[] variableName = new ClassName_[SIZE_OF_ARRAY]; //or ClassName_ variableName[] = new ClassName_[SIZE_OF_ARRAY]; [/code] Where ClassName_ is a valid class name, variableName is the name you give the array and SIZE_OF_ARRAY is the amount of objects you want in the array. an example... [code=Java] String[] … | |
Re: Keep in mind that swing is event-driven. In order to check a word for a character, you should create a method that iterates through each character of that word. public boolean charIsInWord(String word, char arg) { char[] charWord = word.toCharArray(); //iterate through the values of the char array and compare … | |
Ever since I have heard that you can generate classes during runtime (from say, a URL I suppose) and can use java.lang.Reflect to fire methods based on String input, I was wondering how the process is done? | |
Re: A lot of your code is drifting outside of a method or most likely outside of the init/start methods so you're going to have some errors trying to compile. Also if you want to change the way components look in your GUI you will have to use a different LayoutManager … | |
Re: Remember how components work - you can add other components to them either through absolute positioning or through various layouts. You're still trying to add an object (which does NOT have any direct implementation of a LayoutManager) as a LayoutManager. Want to know why? First of all in order to … | |
Re: I hope this doesn't sound too newby but have you tried looking into String Tokenizer? i'm assuming the information is in Strings so you can learn the StringTokenizer class to seperate your string based on a " " or space token. Oh wait it looks like you're using Javascript... I … | |
Re: Keep in mind what Graphics.drawLine does. You're trying to draw a point from i to i, and Math.sin(i) to Math.sin(i) so you're going to get something like a line due to the fact that your points aren't varying from x1 to x2 and y1 to y2. Try g.drawLine(i,(int)Math.sin(i),i + 2,(int)Math.sin(i)))); | |
Re: Line 203 is the problem-- 203 type = console.nextLine().toUpperCase(); Change it to-- type = console.next().toUpperCase(); --and you should be golden. | |
Re: [QUOTE=Dameon;621742]VERY NEW?!?!? I took a full credit course on C++ wrote my exam and everything, And I couldnt hope to make a program like that without loads of help, and the power of ctrl c and ctrl v and the web. New at it, PAH![/QUOTE] Some people (like myself) are … | |
Re: You should initialize your variables moPay and amount to zero and see if the program runs for you. Not saying that is what the values should be, but if you at least initialize them you can run the program and fix the mathematical errors. | |
Re: It looks like he wants to use an inner class as a LayoutManager where when you add peices (or move or remove them) to the application it will add to the Panels listed in the LayoutManager. Seems like a good idea but your GridChessBoard doesnt implement the LayoutManager interface so … | |
I looked up the method class and thought that it might be useful, but unfortunately Method objects must be public to be invoked. I'm just curious of when I'd actually really need to use the Method class. Maybe to create an array that used a type of algorithm to fire … | |
Re: I'm fairly confused as to why you use an inventory4 class than an Inventory4 class... It just adds to the confusion. I'd also like to know how you got that compiler error. What line did you attempt to use Inventory5 (or Inventory5_5 ?) | |
Re: I just briefly glanced your code and noticed an error... if( anArray[n] > anArray[n] ) Why are you comparing the same element to itself? And also why are you returning the same element in either case? Your line should look like-- if( anArray[n] > anArray[n+1] ) return anArray[n] else return … | |
Re: In C++ main has to return an int (or possibly some kind of comprehensible value), not void. [code=cplusplus] #include<iostream> int main() { char cReply; int iNum, iSquare; std::cout << "Do you want to find the square of a number (y/n)?"; std::cin >> cReply; while(cReply == 'y') { std::cout << "Enter … | |
Re: Seems like you'll either have to suffice with while loop that has some kind of waiting case, or you can learn to use threads. I don't know if there is a built-in timer to pause a process (such as a method) being read for a set amount of milliseconds, or … | |
Re: Wouldn't using a preprocessor definition work? For example-- [code=cplusplus] #include <cstdlib> #include <iostream> #define COLUMN(arg) arg using namespace std; int main(int argc, char *argv[]) { typedef int column[5]; //anything marked with column before its variable name will be //an int array of size 5 column COLUMN(a); //an int array of … | |
Hello, I'm having an issue with a line of code that really doesn't seem that it should be giving me an error. Before posting, I've googled this error and looked at related links with no help whatsoever. Most of the "solutions" were for correctly-placed brackets or different names (since some … |
The End.