7,116 Posted Topics
Re: That's nowhere near enough info. But in any case there's loads of tutorial and sample code on the web, just Google it! Come back here when you have any specific questions, and remember the DaniWeb rules you agreed to when you joined, in particular "Do provide evidence of having done … | |
Re: To be fair, the Java 7 source code for String begins public final class String implements java.io.Serializable, Comparable<String>, CharSequence { /** The value is used for character storage. */ private final char value[]; ... so you could reasonably say that a String is an array of chars wrapped in a … | |
Re: You should just get a zero-length String "" for the missing entries. | |
Re: How can a combo box be equal to a String? - they're completely different things. You didn't post the relevant code, but at a guess you probably want to compare the *text* currently in the combo box. I'm sure you can guess the method that gives you the text! | |
Re: Some people extend JFrame, others just create JFrame in the code. I see little reason to extend JFrame unless you want to call JFrame's methods (eg setVisible) from another class, but in real life it's never that simple anyway. You don't normally need to extend anything else for your panels, … | |
Re: "For unknown reasons, gameLoop doesnt want to compile" - that's just silly. When you compile the compiler gives you detailed error messages, including the line number(s) involved. Start by posting the exact complete text of all your error messages. | |
Re: You haven't given any background about data size, data volatility, key-value duplicates etc, but if it's low volatility with only one value for each unique key, I would consider two Maps, the second one having the keys and values swapped so you can retrieve the key directly from the value. … | |
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: You should be able to do that by creating your own TableCellEditor - Google for lots of examples | |
Re: You have two parts to this task. The second part is to create and start a new Thread to execute your code, but that requires a run() method (see the Thread API doc for examples etc). So, the first part is to extract the relevant code from its current place … | |
Re: You are confusing variables and objects. Variables just contain references (pointers) to an object. You create new FileWriter and BufferedWriter *objects* each time. Because you only use one at a time it's perfectly OK to re-use the same *variables* to refer to those objects. | |
Re: I already told you in your previous topic that you cannot use a String to hold a byte array and expect to get it back unchanged. byte[] in = .... String s = new String(in); byte[] out = s.getBytes(); // depending on your default character set, out will NOT be … | |
Re: It's a reasonable one to start with - small and easy. Just get stuck in and try a few things and see what works best. Implementation: simple guideline: put everything you can that is used in >1 subclass in the superclass, so you only have to do it once. This … | |
Re: You could simply have a load of JLabels in a GridLayout and set their text and background colours as required. You could use an array of the JLabels to keep track of them and access individual ones. | |
Re: javac is part of the development kit, the JDK. It's not in the JRE,that's just the runtime environment. Download the JDK - version 7 is the current major version | |
Re: ... and throw an OfferException rather than a DivideByZeroException ahh... the power of copy/paste... ;) | |
Re: Hi P.P. Welcome to DaniWeb Did you notice this thread was marked "solved" 6 years ago? Your contribution is welcome, but it's far too late to be relevant. JC | |
Re: It's called the "Observer" pattern - sorry, no time to explain right now, but Google it for lots of examples etc. | |
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 (which you agreed to when you signed up) include: "Do provide evidence … | |
Re: Re stultusk's post: I agree absolutely except for the anonymous inner class listener. I would always try to use that rather than implementing the listener in the main class because it scales to any number of listeners and avoids the "do everything in one listener" multiple-if nightmare. (And with Java … | |
Re: The code you posted tries to parse "Thu Sep 28 20:29:30 JST 2056" with a format "dd/mm/yy", so of course that doesn't work. What exactly are you trying to do with the "dd/mm/yy" format? | |
Re: For PCs there's only one Java to consider - it's the one from Oracle (formerly Sun) in Windows/Mac/Linux 32/64 bit versions. You'll need the "SE" version as opposed to the "EE" (Enterprise Edition) edition, and the full JDK (Java Development Kit) rather than just the JRE (Java Runtime Environment). NetBeans … | |
Re: Callling run executes those methods on the current thread. You need the Thread class and its start method. | |
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: The Java Language Specification has the definitions of how each each type of constant ("literal" in Java-speak) is represented/defined. See section 3.10 http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10 | |
Re: Here's a minimal runnable exmple that illustrates the key things you need to do - in particular a "model" that has the current values for whatever changes overe time (pahse/position of moon, brightness of sky etc), a timer-based method that updates those variables in a predictable steady way, and a … | |
Re: 1. As stuluske said the error message includes the exact line where the problem happened, so thaT''s where to look. 2. In your constructor you declare new variables for all your fields etc. These "mask" or "hide" the declarations you made on lines 10-15. You set values correctly for these … | |
Re: This is the Java forum. There's no Java on iPhone. I suggest you try another forum. | |
Firefox 21.0 on Windows 7 64bit, the menu of forums (fora?) across the top is corrupted - the Community Center menu doesn't fit and gets wrapped onto the next line.  | |
Re: This thread http://www.daniweb.com/software-development/java/threads/455139/creating-an-autobalancer has a good example of Comparator - about 2/3 of the way through. | |
Re: It's not painting because you don't call its paint method. (You create a new Player on line 18, but you never do anything with it). From the code fragment you have posted it's hard to see what value the Player class is bringing to this program. The map has the … | |
Re: `println` always adds a new line at the end of whatever you are printing. If you don't want every print on its own line just use `print`, or `printf` if you want more control over formatting. ps your lack of indentation, and random use/non use of {} for single-line ifs … | |
Re: I don't want to be discouraging, but there's nothing in there that gives any kind of clue about what happened. Unless there's some other info you can find I doubt that anyone here will be able to help... sorry. | |
Re: Are you sure your arrays are initialised? Just declaring them isn't enough... char[] outPass; // declares a reference variable of type char[]. Its initial value is null; // any attempt to use outPass will give a null pointer exception outPass = new char[99]; // creates a char array, and sets … | |
Re: The Integer class has a parseInt(s) method that parses a string and converts it to an int value (or thows a NumberFormatException if the string does not represent a valid int value). You'll need an array of ints, same size as the array of Strings, and a loop that onverts … | |
Re: Is this a multiply-linked list? Do you know how to insert a node into a single-linked list? | |
Re: ArrayList is still broken. Every time you call `new Player()` you execute the default constructor and start a new ArrayList. That's perfectly good logic considering that the ArrayList is an instance member - one ArrayList per Player, but I doubt very much that it's what you want. Presumably you want … | |
Re: It looks like nobody here knows JFeatureLib. Did you try the the JFeatureLib Google group? https://groups.google.com/forum/?fromgroups#!forum/JFeatureLib | |
Re: Your folder structure needs to match the package structure, so what you just said is only true if the classes are all in the same package. | |
Re: I hope you're prepared for a very steep learning curve! You'll need some basics on Swing (Java's standard GUI classes). Oracle's tutorials are excellent if you just want all the info without too much hand-holding. Have a look at the first few sections starting here http://docs.oracle.com/javase/tutorial/uiswing/index.html if it looks too … | |
Re: You need 4 nested (identical) loops. The System class has a method that gives you the current time in mSec. Call it before and after, subtract the two for elapsed time. Have a go, see how far you get, come back here if you get stuck (post what you hace … | |
Re: nurib: 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 As a final year student you should be capable of doing more than just whining. Post what you have … | |
Re: The idea is to ensure that you always get a valid completely initialised object - you keep calling the setters in the builder until your object is fully specified, then, and only then, you call build() and that returns a complete valid object (or throws some kind of "incomplete or … | |
Re: Here's a little demo I wrote a while ago that runs on Java 7 and has a transparent/shaped/undecorated window (`JFrame window2`). Maybe you can find what you need to know in this code? I remember that the order of the setUndecorated/setBackground/setOpacity/setVisible is critical. J. import java.awt.Color; import java.awt.Dimension; import java.awt.Font; … | |
Re: So what ex actly is the complete text of the exception? It should tell you exactly what went wrong and where. And what was the value of userInput41? You are asking people to help, but you have not provided the info they need. | |
Re: > I recommend that you avoid java.awt.GridBagLayout Just for balance - most of my Java work is GUI-centric, and GridBagLayout is the *only* layout manager I use for anything other than trivial cases. It's the only one that gives me enough control over what happens when the systen font is … | |
Re: If the player is in one tile, and the wall is in another tile, and the Rectanges correspond to whole tiles, and one tile cannot be both 1 (player) and 2 (wall), then I don't see how any of there rectangles will ever intersect. Touch, yes, but overlap, no. Maybe … | |
| |
Re: It's just a convenience thing. It means you can print anything simply like Object something = ... // can be absolutely anything System.out.print(something); // will always work because print actually calls something.toString() and it will always work and usually tell you enough to identify what `something` was. | |
Re: You are confusing objects with reference variables. When you say `String s = "ABC";` "ABC" is an immutable String object, and s is a (not immutable) reference to a String. The current value of s is a reference to the "ABC" object. `s = s + "DEF";` You now have … |
The End.