7,116 Posted Topics
Re: See http://docs.oracle.com/javase/tutorial/java/concepts/inheritance.html Alll the javadoc is [here](https://docs.oracle.com/javase/8/docs/api/index.html?overview-summary.html) | |
Re: local app sends sound remote app plays it remote microphone hears sound being played remote app sends what it hears back to you you hear an echo | |
Re: Was there a question, or did you just want to share this code with us all? | |
Re: Hello Mazahir. Exactly what help do you need? Nobody here will write the solution for you, but if there's some specific problem that is stopping you, we will help with that. | |
Re: You create a frame and a VectorDraw panel, but you don't add the panel to the frame! | |
Re: You did not say what help you need! Please ask specific questions. | |
Re: That code is mostly OK. If you use `i` to index into the arrays to add the words (lines 8,9) then you need to increment it after processing each line (like lineCount). Lines 2 and 3 create two variables that can refer to String arrays, but you haven't actually created … | |
Re: At a far far simpler level I have a NetBeans project that looks a bit like class test { public static void main(String[] args) { // put code to test here } } so when some interesting bit of code appears on DaniWeb I can just paste it in there … | |
Re: You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others here. There are lots of people here who will freely give their time to help you become the best Java … | |
Re: Your post's title says "in Java", but the requirement is "in VB script". Either way, when you have worked out what language you are using, you will find many comprehensive tutorials on the web. There's no need for anyone here you write a new tutorial just for you. | |
Re: Looks like you are missing the call to `showOpenDialog` to make the file chooser do its stuff | |
Re: I guess you've looked through [this topic](https://www.daniweb.com/software-development/java/threads/430542/java-projects-for-learners)? | |
Re: This is the Java forum. That's not Java code. | |
Re: OK, I've written it, and it does compute the average of these numbers and then tell for each number whether it is above, below or equal to the average. What now? ![]() | |
Re: Either have an "Add" button, or wait until the user presses enter in the textfield to trigger adding the item to the queue | |
Re: You have a single blank character at the start of the string. Ie it's " 2", but it should be "2". The blank character is not valid when parsing an integer. Maybe you are initialising out to " " instead of "" somewhere? | |
Re: That's a nice refactoring,... for Java 7 ;) Now for current Java you can take it a lot further and simplfy the code massively. I'm referring to the event handler(s). Just pass the action handling code to createButton, and completely get rid of the hidious 120 line universal ActionListener private … | |
Re: Unless all your tiles are moving/changing all the time, maybe you can just re-paint those tiles that have changed since the last call to paintComponent - if you remove the super.paintComponent call then your Graphics will still contain its previous contents. | |
Re: You have an infinite loop in a MAX_PRIORITY thread (line 215), so it's not surprising that nothing else gets done. What exactly are you trying to achieve? | |
Re: If you want two independent spinners then why are you worrying about giving each its own model? | |
Re: What do you intend with `thisConnection` and `newConnection`? They don't seem to make a lot of sense. Anyway, you can only serialise a class that implements Serialisable (so check its API doc). Some classes (eg ones that are intrinsically tied to some operating system resource and use its state) are … | |
Re: ... and line 40 you are comparing a phone number with a name - obviously a typo. | |
| |
Re: No, it's not the token that's null. What is the value of the reference variable `postfix` on line 23 in the code you posted? | |
Re: How to pop from a queue that just supports enqueue/dequeue: Hint: You can extract any arbitrary member of a queue,eg nth member, by cycling the queue, ie dequeing and immediately re-enqueing n-1 members, then the next dequeue is the desired member. (If that wasn't the last member then you also … | |
Re: I question the need for your own special file format ("much faster" probably means you will save a few microSeconds), but anyway... You can use a DataOutputStream to write java primitives, byte arrays, and Strings to a binary file as a sequence of bytes in their normal internal binary format. … | |
Re: Maybe just loop through the keys of one of the Maps, deleting all the entries that don't have a corresponding key in the second Map? | |
Re: Is there any particular reason to do this in Java? Do you already have Java expertise? Maybe you could do it more easily in a scripting language. | |
Re: Hi Leonard, welcome to DaniWeb Sure, people here will happily help you. Now you need to be more specific about what questions you want answered. If you have errors you don't understand, post the *complete, unedited* error message and the excalt line of code it refers to. The better your … | |
Re: If you want people to share with you that's a two-way process. You should start by sharing what you have done. Or maybe you just want someone to do your project for you - in which case you have come to the wrong place. | |
Re: It worries me that much of this discussion is about the difficulty or efficiency of inheriting either way. And although Liskov is 100% relevant, it's a heavyweight way of expressing the absolute basic English definition: "inheritance" is an *is-a* relationship If a Vector *is-a* Matrix then Vector is a subclass … | |
Re: Take 3 characters at a time (from the right hand end) and convert them to one octal digit. (You could use if tests, a switch, or index an array). | |
Re: Loop through the list printing each Pet in turn. | |
Re: Maybe you could render all your graphics at some fixed resolution (eg HDTV) and use a `scale(double sx, double sy)` to scale all the contants to whatever the actual screen resolution is? As for speed... what Timer are you using? | |
Re: Opening and closing multiple streams on a single Socket can cause data loss problems (buffers discarded etc). Opening multiple streams and not closing them is even worse. You could try creating the input & output streams just once, when you do the connect, then use those streams when sending. | |
Re: Many many people run Java Database code in Eclipse, and it works very well. There are many tutorials on the web. If you would like help here you must explain exactly what you tried and what problems you had. | |
Re: You have no choice but to read the file from the start until you get to the line you want. (Unless the lines are all the same fixed length, in which case you can use a random access file and seek directly to the calculated offset of the desired line) | |
Re: Instead of just sending fixed length buffers, send a byte count followed by the buffer. For most packets the count will == the buffer size, but for the last packet the count will tell you how many bytes are data, so you can ignore the rest. | |
Re: Yup XMLEncode and XMLDecode will convert anything bean-like to XML dead easily. Also works for beans-within-beans, so you can encode/decode an entire List, or arbitrary top-level container object in just one method call. You could also create a zip file with all your files in it (java.util.zip.*) | |
Re: Wrap the code in a no-args method, eg public static void doMyStuff() { ... then new Thread(Client::doMyStuff).start(); Easy or what? ps: I don't like seeing all that in static methods, but that's another question. You will presumably need multiple instances of the class (different instance variable values) for your multiple … | |
Re: Acceleration may be due to starting a new timer each time you click - n timers = n times as many events per second (?) | |
Re: Some of the cases do have breaks, but that's not the real problem. (sorry Ant695 but you're going to kick yourself when you read this...) You should be switching on the chosen planet, not the person's weight! J | |
Re: Because bytes are integer values. Doubles are 8 byte floating point values. When you assign a float value to a byte it's rounded down to the nearest integer value. You also have a problem if the value is >127, becuase that's the largest value a byte can hold. Either way, … | |
Re: The only thing that matters is that you load the tile once to create a Tile object that persists for the whole game. Provided you do that, `static` or `final` won't make any difference. Regardless of how you track those objects (in an array or a List etc) they still … | |
Re: They are two different Objects that happen to have the same values in them. They occupy different places in the JVM's heap, and have different hashes. The == operator will return false. You can change one of them, and the other will not be changed. All Java objects have an … | |
Re: This looks like a pretty way of describing a Convex Hull to me. ps: I wonder why they specify the max number of records of data (20), but not the max number of points per record? ![]() | |
Re: What's CircleClass? - I don't see any definition for that. | |
Re: Rubbish. Text pad will not convert a .class file to Java source. Never has. |
The End.