4,084 Posted Topics
Re: a few other remarks, about how you "detect" which button has been clicked: `if (buttonclicked.getText().compareTo("START") == 0)` a better way would be: `if ( "START".equals(buttonClicked.getText())` it's shorter and it follows the naming conventions a bit more. but, and here's the big 'but' comming up: what will you do if there … | |
Re: the class itself is not a member of that other class, but an instance of it is. not entirely sure what your question is, or what your teacher said, but sure, if you create a class MyClassA, you can have another class with a MyClassA as either instance or static … | |
| |
Re: also, get your terminology straight: Java doesn't have functions, it has methods. if I'm not mistaken, Connection is not a class, it's an interface. (I assume your ConnectionDB implements Connection?) `private static Connection myConnection = new ConnectionDB();` | |
Re: read the input process the input to output look at the output. if you need to work with xml using Java, [JDom](http://www.jdom.org/) is a stable and very well documented library that can help you there. | |
Re: well, cross-posting is not really appreciated. basically, you don't show us any code, and the description you give (on the other forum) shows that even though your syntax is right, you've added the wrong fields the wrong number of times. the best thing to do is to think over the … | |
![]() | |
Re: either you say: protected double avg = avg = st_marks/2; or you should set the value inside a constructor or method. | |
Re: if you had checked the code, you'ld probably have seen that the chances of it compiling, let alone running, are pretty small. for instance: `while(city != *)` with city being a String, should probably be `while ( !city.equals("*"))` also, the indentation isn't very clear. I can see where that loop … | |
Re: > This works, but the user does have the ability to add a greater number of courses than 6. So this way any buttons great than index 5 would be useless. I have .... no idea what you're trying to say there. (one of) the advantages of Lists and Collections … | |
Re: imBaCodes: so, if some cheap-ass industrial dumps a lot of toxic waste in a healthy environment, damns the next x generations to a certain, painfull and very fast death, then > Its because god decided some of us to have it. seriously, I hope you are kidding. it's a bit … | |
Re: the class name in your code is 'CheckigAccount' (without n) that might be your problem. | |
Re: hmmm ... I was thinking of buying myself a new desktop (bit more power under the hood, easier to upgrade, ... ) but with all the mess that Windows 8 basically promisses .... don't really have the time to go shopping for all different parts and assemble it myself, was … | |
Re: `static void main (String[] args) throws Exception` have you tried by declaring your main method public? also, it's bad design to allow your main method to throw Exceptions: you won't be able to prevent your application from crashing if something were to go wrong. | |
Re: you mean if you enter First Middle Name, that you get a label with FMN? sure, why wouldn't that be possible? | |
Re: just ignore the NetBeans wysiwyg "tutorial", the rest should be able to help you out. [Java Swing tutorial](http://docs.oracle.com/javase/tutorial/uiswing/) | |
Re: you don't really "leave" your main method.. so, instead of focusing how to get back in it, focus on how not to get out of it :) as JavaAddict already mentioned, your program will run the code in your main method, and if that is all finished, your program will … | |
Re: depends, whether those that hold the copyright allow it or not. but what if the code was posted there before it was posted on DaniWeb? :) | |
Re: for webapps, GWT is not too hard neither, or for desktop applications, you can learn a lot by getting to know Swing. but if you are, like you say, just looking into Java without having any experience or knowledge about it, getting to know the language first might be a … | |
Re: there are quite a few tutorials around about working with Timers. have you taken a look at those? | |
Re: another good reason is to keep the main part of a class's functionality, but to alter the functionality of, let's say: one method. but extending JOptionPane makes no sense, since about all it's methods are static. | |
Re: "I know a bit of Java", and with that you assumed you know enough to write a platform based 2D game? I wish you all the luck. what have you got so far? | |
Re: you expect us to debug your code without seeing your code? | |
Re: either you instantiate it in your main method, or you call the instance from your level class). but why are you passing a reference of which you are sure it'll always be null to a method? that's pointless. MainClass.java: `EnemyBoss enemy;` Level.java: `EnemyBoss enemy = new EnemyBoss(5, 10);` just because … | |
Re: ' is a special character in Java. have you tried using an escape character? | |
Re: [official classes tutorial](http://docs.oracle.com/javase/tutorial/java/javaOO/classes.html) | |
Re: it's pretty easy to play sound files. .wav files are supported by core Java, no additional libraries required. if you want to play .mp3 files, on the other hand, you'll have to look for some additional resources: [jmf](http://www.oracle.com/technetwork/java/javase/download-137625.html) (even though a bit outdated) can help you, but in my personal … | |
Re: also, in one of your first posts in this thread, you had something like: final int dollars = 0; ... dollars = dollars; this is quite ... weird. first of all, the final keyword won't allow you to change the value of the variable once the value has been set. … | |
Re: do understand this is a Java forum, not a JavaScript forum. the JavaScript forum can be found [here](http://www.daniweb.com/web-development/javascript-dhtml-ajax/117) | |
Re: also, quite important: you should adopt good coding habbits as soon as possible: make your instance variables private and use mutators (setters and getters) to get to them from outside the class. this 'll help with encapsulation. | |
Re: no problem with that code at all. do you get an error message? have you checked the value of the path you are trying to pass? | |
Re: and what exactly is your question, if you have any? | |
Re: or just add: `return false;` to the end of your method. | |
Re: that depends. first of all, do you know what the 'this' keyword refers to? | |
Re: contradictory to the rules IMHO. it's a bit annoying to repeat information,or to post jibberish, but if this would go through, someone might have to do that, just to give an opinion. | |
Re: > Everything in java is object even the primitive datatypes can also be converted into object by using the wrapper class. let's agree to disagree. here you are contradicting yourself (in my defense ;) ) first, you say that everything in Java is an Object, then you say there are … | |
Re: anupgupta: this is not a decent reason to revive a dead thread. it hasn't been replied in for three years, that should tell you enough. also: the information you need is posted above, read, click, use. we're not going to deliver you custom made code if that's what you're hoping … | |
Re: in the end, nobody can know everything about any language. get used to it. no matter how long you'll be working, you'll always need to choose between stuff to learn, and what not to. | |
Re: can you be a bit more specific then just "the problem"? | |
Re: didn't downvote, just replying on the post above that: you also need to remember that if you use the name val in the declaration of the array, you should also use the name val (not values) when trying to print it's contents. | |
Re: so ... what makes you think you need to change anything about the Javascript code? the css.... maybe. but otherwise, nop. | |
Re: by instantiating that class two times. Bullet bullet1 = new Bullet(Color.RED); Bullet bullet2 = new Bullet(Color.GREEN); but I do hope you understand why this part of your code makes no sense at all: public void Bullet extends Item { int dx = 1; } | |
Re: you can run each (desktop) or command line java application, by running the next command prompt command on the class file: javac yourClass (if yourClass is the class that contains your main method, of course :) ) normally, a .jar file should work and get you able to run your … | |
Re: that's a nice assignment. now ... do you actually have a question to go with that? if no.. read the community rules. you are welcome here to study Java by improving your skills, not by asking us to do your homework for you. please take a look at the [Community … | |
Re: yeah well, that ain't what you need. check [this](http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774) | |
Re: objects, instances, ... yup. for instance: Person me = new Person("Stultuske"); Person you = new Person("game06"); In the above lines of code, there's only one class: the Person class. there are, on the other hand, two instances of it: me and you. | |
Re: > I wish you to help me in solving this homework you could at least be honest and replace that line by > I wish you would do my homework for me | |
Re: don't really understand what you're trying to do here. especially since you can't translate words letter by letter. for instance: > fire > brand (the dutch word for fire) > feuer (the german word for fire) > incendie (the french word for fire) this should show you two reasons why … |
The End.