7,116 Posted Topics
Re: Regardless of what your prof may or may not have said, DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules When you signed up for this web site you agreed to abide by all its rules. | |
Re: Here's what your code is doing at the moment... iterator1 = ... iterator2 = .... while (iterator1.hasNext()) { ... while (iterator2.hasNext()) { ... } // after the first pass you have now used up all the elements in iterator2 // next time round the outer loop iterator2 will still be … | |
Re: Which calendar control would that be? | |
Re: file.getName() just returns the file name - any path info is lost. So unless the file happened to be in the current working directory it won't get found just from the name. You could try getting the full path & name to identify the file fully, eg file.getCanonicalPath() rather than … | |
Re: Please check the Daniweb member rules before posting http://www.daniweb.com/community/rules DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" | |
Re: A lot depends on where you may want to go afterwards. If you see a career in enterprise Java then go with EE-specific technogies like servlets and jsp. On the other hand if you just want to improve yur general Java and programming skills then build something using Java SE … | |
Re: Stack overflow is usually caused by recursively calling a method from itself. (Too many objects created normally throws a OutOfMemoryError exception, not a stack obverflow.) The error messgae tells you the exact line in your code where it happened. Without that info we can't do anything. | |
Re: Perhaps a modal dialog will meet this requirement if it happens during the exceution of your code? If you want this to display while your program is loading/initialising then Java 6 has splash screen support to do exactly that http://docs.oracle.com/javase/6/docs/api/java/awt/SplashScreen.html | |
Re: I don't know of any such standard component, but you could simply disable the button in its actionPerformed listener to stop it being triggered again. | |
Re: Norm - did you check the date? J (I deleted the spam post this morning) | |
Re: What coordinates? In what way "more accurate"? I think you need to explain this question in a lot more detail. | |
Re: If you have the default installation then your jar is being run by javaw.exe, not java.exe That means there is no console window, so you don't see any IO from a program that just uses the console. Try running the jar with java.exe in a command window. | |
Re: @godzab: In the example you gave, do you want to remove the 2 from java. lava, or both? What if there are duplicate entries in either one of those two lists? ps: Guys - what's all this fortran-style for looping and hand-coded searches? This is Java, we have enhanced for … | |
Re: Hello Anil Your solution comes 8 years too late for the OP, and anyway we don't do peole's homework for them, we try to teach them to do it for themselves. | |
Re: DaniWeb Member Rules include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question This thread is closed. | |
Re: DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: > Java variables must be initialize when you use them. > String name = ""; etc etc They must be initialised before you use their value, but that does not mean that they must be, or should be, initialised when you declare them. Initialising like that is only useful when … | |
Re: Obviously you can pass a reference to the text area into the processing code and thus update it directly, but that would totally undermine your correctly-engineered architecture. Or you could use the "observer" pattern and enhance your processor code to allow you to add a ChangeListener to it. Then you … | |
Re: How far have you got now? Have you installed the JDK? If so, that's all you need for now for ordinary Java development. You don't need any other plugins or libraries. A programmer's editor such as notepad++ would be useful but not essential. Did you follow the tutorial link Norm … | |
Re: DaniWeb Member Rules include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question, post the relevant code, and the full text of the error message This thread is closed. | |
Re: DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: Don't invent your own mwthod signatures. Look at the `Comparable` interface in the API doc. If your class implements its `compareTo` method then you have a standard way of comparing your objects. This is how the standard sort methods work as well. | |
Re: It's integer arithmetic, performed in integers throughout. eg (10/20)x100 10/20 in integer = 0 - there's no fractions in integer values 0x100 = 0 on the other hand (10x100)/20 10x100 = 1000 1000/20 = 50 | |
Re: There's something odd about the file reading. In main you read a file one line at a time then pass that line to calculateHash as a String. But in calculateHash you treat that String as a file name and try to read lines from that file. Unless `C://Users//NTU//Desktop//hash.txt` contains file … | |
Re: You can add a number to a running total with a simple addition eg total = total + nextNumber; every time you execute that witha new value for nextNumber the total will increase. | |
Re: Maybe a bit harsh, stultuske? Probably the most important thing in chosing a big project is that it should be something you're actually interested in and know something about. I might want to build a wine database, but maybe you would rather do a badminton league / knockout competition application. … | |
![]() | Re: There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in doing your homework for you. DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting … |
Re: Yes, there are lots of people here who can help you, but please check the Daniweb member rules before posting DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules _______________________________________ | |
Re: There may be a problem with your ItemStateChanged methods. They will be called whenever the state changes - ie they become selected *or deselected*, but your code is intended to run only when the state becomes selected (?) | |
Re: DaniWeb Member Rules include: "Do post in full-sentence English" "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: I would keep the main method in the project class and ignore/discard the one in the JFrame class. My reason is that starting a program, in general, is more than just opening the main window. In real life you may need to create a database connection, start a server instance, … | |
Re: 1. Use a file open dialog and let the user chose the file. (Easy, but requires user involvement) 2. Use System.getProperty("user.home") to get the user's home directory and place the file there (or in a specified sub-directory). There's always a user home dir, even though it may be in completely … | |
Re: > .Throw an error if the input number is less than zero. You missed this part out. The catch is OK, but you don't throw the exception when the input is wrong. | |
Re: Client/server coms via Java internet Sockets really isn't hard - [here's](http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html) a good short tutorial to start with. A server for synch and gamestate etc is a perfectly reasonable way to go. SQL would be another area of complexity to master, so maybe better left for version 2? Java language … | |
Re: You could pass the (reference to the) ArrayList to the constructors of the various dependent classes so they all have access to it when their instances are created. Giving them direct access to the list (via passing refs or sharing a global) can be dangerous - anyone can make any … | |
Re: input cannot be "yes" AND be "no" at the same time, so that if test will always be false. | |
Re: The ArrayIndexOutOfBoundsException meesage includes the line number where it happened, and the index value. Both these are critical info for finding the bug. | |
Re: I agree with rubberman. Start with UML uses cases -> class diagrams -> sequence diagrams. Once you've done that you have the basic structure of your code (classes / important variables / public methods) all planned out. See the first few sections of [this](http://www.ibm.com/developerworks/rational/library/769.html) Personally I'm no fan of state … | |
Re: If you want to play that game... static final String[] romans = {"I", "II", ... etc ... if (num>=1 && num< 10) JOptionPane.showMessageDialog(null, romans[i-1]); | |
Re: The equals method is defined in the Object class, so in the API docs you will find it listed in the "inherited methods" section. That version of equals tests for the the objects being exactly the same object (at the same memory address), so that's what you get if a … | |
Re: Sorry stultuske, but I found your reply very confusing. Once you create an instance of some concrete class that instance can never change its type. A SampleB can be added to a Vector<SampleA> because SampleB is a subclass of SampleA. But nothing is "stripped from the instance", and a SampleB … | |
Re: 1. Never, that's NEVER, have an empty catch block when you are devoping code (lines 27-30). How will you know if Java has detected an error? Always start with an `e.printStackTrace();` in every catch block. 2. If you do that, but there are no exceptions thrown, then add print statements … | |
Re: You don't have to put the source code in the jar, so don't! You do have to put the class files, so there's no way to stop someone looking at the byte codes and trying to reverse-engineer a source version. You can use a tool called an obfuscator to remove … | |
Re: DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: > I changed the increment to a preincrement instead of postincrement; the performance is a little better. This may have been true some time in the distant past (by "a little better, maybe 0.00001% faster overall?), but for any current compiler these three forms should generate exactly the same optimised … | |
Re: "Teach yourself Java in 21 days" reminds me of the classic guitar teaching book "Play in a day", as used by Eric Clapton etc. It takes a lot lot longer than 21 days, or 21 months to learn Java. After 21 years you'll still be finding new classes in the … | |
Re: The requirement includes a parameter thats passed to the compareParity method, but your method has no parameters. | |
Re: Did you download the JDK or just the JRE? What OS are you using? | |
Re: It's integer arithmetic, normal maths priority, so cor/10 = 0 (would be 0.3333, but this is integer math) 0*50 = 0 0+50 = 50 To fix it, change the order of your expression so the * is done before the /, ie cor*50 = 150 150/10 = 15 15+50 = … | |
Re: Do you have an error message (eg something about static context?). If so please post the exact complete message (copy/paste, don't summarise it) |
The End.