4,084 Posted Topics
Re: probably an error in your actionListener, or you haven't attached it to the right components, or you didn't check for the source correctly. that's a lot of code to go through if you don't know what you're really looking for. | |
Re: and that if you "change" the value a lot, and don't need to keep the old value, as is often the case when using Strings, you'll stuff a lot of values you don't need into your memory. | |
Re: nest your while loops: while (num != 1){ while (e == true && num != 1) { do statement } while (e == false && num !=1) { do different statement } } System.out.println(value); something like that might help you out. | |
Re: trust me, that does not return "[B@3df78040". I don't know how you added that, and since JamesCherill showed you exactly how to change your code, I also have no idea how you could 've gotten it wrong, but apparently, you did. re-read his post and try again. | |
Re: [This](http://stackoverflow.com/questions/3844307/how-to-read-text-file-from-relative-path-in-a-project) might shed a little light on the subject. | |
Re: I've got the feeling your error starts here: negCheck = stdin.nextDouble(); make sure you provide correct input. if necessary, run the code first with hardcoded values. | |
Re: well, if you don't know anything about a programming language, thinking about a project is like a toddler that just learned how to crawl, and think he can run a marathon. no, Java isn't that hard to learn, but if you want to learn it decently, it still might take … | |
Re: hate it to tell you, but if I look at the assignment and then your code, I can't help but feeling you're way off. best thing is to split the assignment in logical steps, and to try and write and combine those to a working piece of code. | |
Re: why do you have unsorted lists if you don't use them? I think you'll easily be able to do that, with using the right widths and floats along with your div tags. | |
Re: satdude, this thread is over a year old. if you have a problem, please start your own thread and be a bit more specific. in a lot of "I have the same problem" posts, it turns out that even though it "seems" related, it's not. | |
Re: no matter what, unless that method is static, you shouldn't call it like this: BTEST.call(); use public and private access modifiers. | |
Re: looks to me like you have to input the values for the elements manually, that is, going on this: > The program reads the food grid from the keyboard | |
Re: read the code, write down (in pseudo code) step by step what it does, and what values are assigned, that 'll help understanding it. | |
Re: well, what do you think this will do d = Double.parseDouble (SubTotal.getText ()); if SubTotal's value is ""? before you do something as above: d = 0; if ( !SubTotal.getText().equals("")) d = Double.parseDouble(SubTotal.getText()); | |
Re: you can write sql, sure, you can also use a framework like hibernate. you can check the number of results you get in your resultset, or check if it returns null. | |
Re: no. you'll show that line at least once (the first iteration) I'm not sure why you're going for "findWithinHorizon", you could also have gone for next or nextLine, and just read the first char. | |
Re: you can use the instanceof operator to check of which class each animal is an instance. | |
Re: can you please provide the complete error message? it tells you on which line the exception is thrown, so if you look at that line in your source code, it should be easier to find out where it's going wrong. | |
Re: just google "Scanner java api" and go to the latest version (7), then search on the page, and you'll find this: [that method in the api](http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#findWithinHorizon(java.lang.String, int)) | |
Re: (edit: refers to deleted post) | |
Re: join you in what? and what common language will you use? looks to me like english isn't the best option. what you should realize is: Steve Jobs and all those others who made name and fame by (re-)inventing and/or improving systems in a way nobody thought possible, didn't start out … | |
Re: what exactly is your question? where are you stuck? for instance, keep in a file an array with the countries: static String[] countries = {"Belgium","Netherlands","Germany"}; // just an example //and for each of these countries, you keep an array with cities: static String[] bCities = {"Antwerp","Brussels"}; static String[] nCities = … | |
Re: yes, that's possible, but would make the private method useless. private methods are normally used to perform "private" stuff. at this point, it is clear that your teacher does not want your main method to have access to your private method (otherwise he would've told you to make it public). … | |
Re: eh? you can't extend more then one class directly, besides: extending a class is in the (compiled) code, so you can't do that "on the fly". what you could do (I guess) is something like this: interface MyMarker{} public class MyFirstClass extends Parent1 implements MyMarker{ } public class MySecClass extends … | |
Re: to give some more information about my downvote towards your post: this is a community of volunteers who will help you learn and improve your code and coding skilsl, not 'devZ-for-hire', and no, we won't do your homework for you, not even if you post this three times. the community … | |
Re: depends on the action on which you want something performed. when selecting a new value in a dropdownlist? after clicking a button? after typing a character in a textfield? | |
Re: different things: 1, if possible: use the Swing components, not the older AWT stuff. 2. don't forget to actually link your buttons to your actions. you'll have to add an ActionListener | |
Re: if they are external, they can be placed: "external". do remember that your java code is not dependant of the IDE you use, so if it works in eclipse (or editplus), it'll (should) work in netbeans as well. but the path to the images might differ, since it's not the … | |
Re: the best way would be to re-write your sql code. but correct, this time. | |
Re: either ignore it, or don't use unchecked or unsafe operations .... if you want more information about what the 'problem' (it's more a remark then a problem, but still) is: do as the message suggests and recompile with the -Xlint:unchecked argument. | |
Re: Zach&Kody: re-read your post, and you'll see why that's impossible. (and certainly not what is wanted). either you return a default value if none of the cases are true, or throw an Exception. | |
Re: logical errors tout court: switch (int index) { case 1: if(index=0) do you know what a switch and an if is? do you know the difference between = and == ? what exactly are you trying to do in these three lines? | |
Re: jLabelWithError.setVisible(true); and to hide it again: jLabelWithError.setVisible(false); | |
Re: do you still get that error? well, if your code is like: > // > Here I add ... then that's bound to cause problems. is the above your entire code? you're not closing your method/class. if you still get an error, can you post the correct (and complete) code, … | |
Re: ehm ... no, if it's a static method/member, you don't need an instance of the class. you can call it through an instance, but that would be confusing and might make you believe that the value of the static member depends on the instance, which it doesn't. static means: class … | |
Re: what exactly has this got to do with packages? your constructor needs a space between public and Square looks like you are accessing the Square variables directly, so maybe re-think that. for instance: your method to calculate, you could do something like this: public int computeSurfaceArea(){ return depth*super.computeSurfaceArea(); } and … | |
Re: Carmageddon (the original game) and Freelancer. there were some other games that caught my 'attention' for a few weeks, but these two ... bought them once, still play them. Carmageddon (thanks to GoG.com) still playing after 15+ years, Freelancer after (almost) 10 years | |
Re: personally: a plastic ball, jumping ropes, maybe a doll or two, and a garden. there's no doubt she'll get a gaming system sooner or later, but I wouldn't recommend too soon: I've seen kids, just over ten, who've had their first console when they were six. summer or winter, they … | |
Re: the best kind of project is the one you think of yourself. choose one you can do using the techniques you've learned. since we don't know your curriculum, don't expect us to know the ins- and outs of it. choose a subject that you're interested in, thus avoiding getting 'bored … | |
Re: don't. program them manually. generated Swing code is crap and very difficult to maintain. | |
Re: it makes it needles complicated. just a short example: int one = in.nextInt(); int max = one; int low = one; int two = in.nextInt(); if ( max < two ) max = two; if ( low > two ) low = two; int three = in.nextInt(); if ( max … | |
Re: for jdbc:mydql://localhost//a_upload there's a typo there. try "mysql" instead of "mydql" | |
Re: also: whoever asked you this, either wasn't talking about java, or doesn't know what (s)he's talking about. In java, there are no functions, just methods. besides, just because you pass a parameter, doesn't mean you have to use it (ok, it's not logical to pass a parameter you don't use, … | |
Re: They claim to be a "Microsoft Gold Certified Partner", but I don't see their name ("Soft Buy") on the list I found for Microsoft Partners, so I doubt it. | |
Re: ehm ... what's the difference between a Car and an Tomato? that's about the same question. | |
Re: I think you would be better of learning a bit more about [IO operations](http://docs.oracle.com/javase/tutorial/essential/io/file.html) in Java. | |
![]() | Re: pretty sure I'm not going to win it, and that's about as far as my personal interest goes. |
Re: the classical way would be by using the <img > tag, but you can always do it in css as well. | |
Re: what do you mean: is only working for the first? what happens if you use a next one? is there an error message? add some print statements through the code to see what happens/is executed. also: do understand that using it like that, you might easily mistype one of those … |
The End.