7,116 Posted Topics
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 helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) … | |
Re: That's not a complete prograqm, it's just the interesting bits, so you can't run it. ps Many of our members have English as their second (or third...) language, so abbreviated language will be unreasonably difficult for them. Please keep to proper English. DaniWeb Member Rules include: "Do post in full-sentence … | |
Re: setMnemonicAt(int tabIndex, int mnemonic) http://www.kodejava.org/examples/733.html | |
Re: The Java compiler is your friend. Don't be afraid to try and compile your code. There's no point trying to get it right before compiling. Just chuck it into the compiler and see what errors it throws up. That costs you nothing. At first you;ll get a lot of errors, … | |
Re: It looks like maybe you start a new timer when you restart, but the old timer is still running, so now your actionPerformed gets called twice every 10 mSec, and every time you restart that gets worse. Make sure that when you restart either you just keep using the old … | |
Re: I don't agree with sleep here. The "application" can't sleep, only a thread can sleep. After the start() method everything in this code runs on the Swing EDT, and sleeping that thread will kill the animation (and any other swing activity). Three solutions: 1. When you set the text, set … | |
Re: Unless you are runnning a very old verison of Java you can convert an Integer to a Double trivially using auto boxing/unboxing: Integer i = 3; Double d = new Double(i); Your array index exception is at line 42 of Poly.IntegerPolynomial.getCoeff, where you are trying to access element number 3 … | |
Re: If this simple exercise is causing problems its probably because the idiot who designed it doesn't understand inheritance. Inheritance is a *is-a-kind-of* relationship, and a cylinder is NOT a kind of circle. What happens if I add some perfectly sensible methods to Circle like `boolean containsPoint(int x, int y)` ? … | |
Re: > Should you check for equality before swapping? The detailed argument depends on whether the array is of a primitive type or contains objects. For two primitives an equals test will be trivial, and a swap pretty trivial too. For objects you will use a Comparator to determine the sort … | |
Re: I would try all the same, already sorted, and already sorted but in the opposite order (which will be the worst case for some algorithms) | |
Re: OK guys, that's enough now. Please restrict yourselves to answering bobit's orignal post. Thanks. | |
Re: I not sure that your resizing method will correctly get the size in the final result. Use *getScaledInstance* to resize an Image safely. | |
Re: Whenever I need to reduce stress I find a post that was obviously intended as a joke and take it very very seriously </humour> | |
Re: I've never seens anyone add GUI components inside a paint method before. It wouldn't surprise me if that didn't get painted, at least not until there was some otehr event that caused another repaint. Anyway, it's a terrible idea. Paint gets called for all kinds of reasons, at any time, … | |
Re: EliteNMC: What exactly do you mean by "spam-bot" - is that something that finds and deletes spam, or something that sends spam? | |
Re: You probably have to eliminate the duplicates from the data you are inserting into the combo box. One way to eliminate dups is to add all your data to a Set (eg TreeSet,use the addAll method) because Sets don't contain duplicates. Then you can simply convert the Set to an … | |
Re: Java is trying to print your Pair instances, which it does by calling their toString() method. All classes inherit one from Object, which just returns the name of the class and it's hash code, eg Example$Pair@1fc4bec To print something more useful, override the ` public String toString() ` method to … | |
Re: I vote for the second version. The extra lines and indentation in version 1 create a lot of clutter and will push the following code off the screen - just imagine it inside a loop inside a method definition... | |
Re: Are those methods defined in the AbacusModel class? In that case you created an instance of that class on line 23 as part of your constructor, so you can use myAbacus to call those methods. Without seeing the method definitions it's impossible to comment on what parameter(s) to pass. I … | |
| |
Re: What's wrong with the answer I gave you when you asked this in your other thread a few minutes ago? | |
Re: There's more to this than it seems. Here's a simple *single* source file public class MulipleMains { public static void main(String[] args) { System.out.println("One"); } } class MulipleMains2 { // can't be public public static void main(String[] args) { System.out.println("Two"); } } Eclipse will let me run that single file … | |
Re: Is this an attempt to bump [this thread](http://www.daniweb.com/software-development/java/threads/449778/how-to-bundle-jre-inside-jar-to-run-jar-in-non-java-system) ? | |
Re: When you say "not opening", exactly what does or doesn't happen? Do you see any error messages or other output? What happens if you open a command window and run the jar with java,exe? | |
Re: Now my question is, how would I go about making an array that will hold the attributes of the class circle in the geometry class? Answer: you don't. The individual Circle objects hold their own attributes, all you need is an array of Circle objects | |
Re: Why are you overriding those methods? What's wrong with just inheriting them? Your overides look just like the originals anyway. | |
Re: To call an instance method of the CustomerModel class you need an instance of that class. Your CustomerController creates such an instance on line 25 (cMod), so you can use that to call the method(s), as in cMod.search(etc... | |
Re: One small suggestion: To help you read that data back in again you may want to write the number of columns and number of rows at the beginning of the file. Otherwize you won't know how many column names to read before starting to read tha data, or how to … | |
Re: This seems like a bad idea, even if it's possible. How will you handle essential security updates to the JRE? | |
Re: The server seems to be waiting for input from its local user before it tries to read iput from the remote client. That seems wrong. Line 23 may be the problem. ps Next time please describe your problem properly - eg what results you expect vs what you got. Saying … | |
Re: There may be some advantage in using java.util.Timer rather than sleep (fewer threads hanging around, easier to clean up resources between events). All you can do about memory handling is to ensure you don't keep any references to objects you no longer need. Try running a profiler to see if … | |
Re: Unless you are processing a vast number of dequeues against a huge queue then "faster" is not going to be relevant. Do you reeally care if they take 1 microSecond vs 2 microSeconds? Easy to code, easy to read and understand, easy to debug, easy to modify or enhance - … | |
Re: If you are sending screen captures for a remote monitoring kind of app then you may find [this](http://www.daniweb.com/software-development/java/threads/254810/find-the-differences-between-two-images-and-the-locations-of-the-differences/) thread interesting. A few of us tried all kinds of ideas, and found the best performance by keeping a connection open, and sending only the differences between each screen and te previous … | |
Here's a simple thing that I can't find a simple solution for - so any suggestions will be very welcome... I have a `Map<String, MyClass>` and if it has more than 1 entry I let the user pick a MyClass instance by displaying the keys. No problem there. If it … | |
Re: Disclaimer: I haven't used these classes, I'm the opposite of an expert on them, but since nobody else has chipped in and Stefan is getting desparate... When you start the first Clip playing you use a local variable for the Clip, so when the method terminates you no longer have … | |
Re: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there. | |
Re: If your method declares a return type (boolean, int etc) then every possible execution of the method MUST return a suitable value. You have if/else tests that, if they are true, do not return a value. You must add return statements so that every possible path through yopur methods returns … | |
Re: Don't confuse variables and objects. std in the create method is a variable, specifically a reference variable. It's scope is the body of the create method, and it will cease to exist immediately when the method finishes executing. Line 13 does not create a new variable, it just changes the … | |
Re: yes. Just call the appropriate method for the toggle button in your action performed method for the stop button | |
Re: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there. | |
Re: What exactly is your question? - the code you posted displays the results. | |
Re: It's hard to understand that description. Maybe if you posted your actual code so far that would be clearer? Does B extend A? | |
Re: You can loop through all the keys, or loop through all the values. HashMap has methods that give you all the keys or all the values so you can loop through them. Inh this case you could loop through all the keys, checking the values that each key refers to, … | |
Re: setSelectedItem or Index should work - if they didn't then the problem is probably elsewhere. Without seeing your code it's impossible to tell. | |
Re: It looks like `obj.getProductId()` should not be inside the quotes - it's not part of a string literal, it's an expression you want evaluated. | |
Re: Debascoguy: DaniWeb Member Rules (which you agreed to when you signed up) 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: > As for 5th question > This program is to reverse the array elements Are you quite sure it doesn't just rotate the elements right by 1 position? [ edit: original post now updated as per IIM's comment] | |
Re: Java is parsing the last semicolon on line 18 as the statement that the for loop has to execute. Since it doen't contain any code (just a ;) that's what is called an empty statement. It also means the block that starts with the { on line18 is not part … | |
Re: Maybe the variable customerService is null at that point - if you posted the exact complete exception messgage then it would probably be clearer, or try printing customerService there to confirm. |
The End.