7,116 Posted Topics
Re: `bookVersion = pub.setVersion(bookVersion);` your `set` methods are void, so they don't return anything, so there's nothing that can be assigned to `bookVersion`. It's traditional for `set` methods to be void, but latest practice is for them to return `this` so you can chain them together (so-called "fluent interface"). Just a … | |
| |
Re: rproffitt: Sorry, but it does look to me like you have missed Gorge's point. He has got a working algorithm, but has a specific problem with intersections that have 4 (or more?) exits. Sorry if I have misunderstood your replies. To me it looks like an artifact of the details … | |
Re: Just a guess: Its line 12 that's the problem. `rows` is the number of rows, so valid values for the second parameter should be 0 to (rows-1) | |
Re: Another observation is that firstname is so far from unique that it's completely useless on its own as a key. Just wait until you have 100k users and you search on "John". I suggest you go back a step and avoid this ever happening, eg default the name sfields in … | |
Re: First, selecting a shape by clicking inside it... the `contains` method comes from `Shape`, so assuming you have some kind of list of the existing shapes you can iterate through that to see which Shape contains the mouse pressed point (if you allow overlapping shapes then there may be more … | |
Re: That's a very general question. Please be more specific and *show what you have done so far*. | |
Re: > Who's UI? Don't worry - it's a bit of an ongoing in-joke here at the moment. I've sent Dani a PM on your behalf to let her know you want to get in touch. JC | |
Re: Hi Darren Please start your own new thread for your question - do not hijack other people's old threads. Don't forget to ask clearly what help you need, and show what you have done so far. Someone will help you. | |
Re: Normally for an undo you would get rid of the last thing you added - ie remove the last Triangle, Rectangle, or Circle from its corresponding list, then redraw. Your code deletes all the Rectangles in the list - regardless of how many there are, and regardless of whether the … | |
Re: Because you add the triangle to `triangles` every time mouseDragged is called, so you end up with it repeated many times. You can do something like: mouse pressed: create a new Triangle object mouse dragged: update the Triangle object mouse released: add the Triangle object to `triangles` If you want … | |
Re: We bought a new Renault Zoe at the end of last year and are glad that we did. It has a realistic range of 250km after an overnight charge which covers almost all our driving needs. We kept our big old Citroen C4 Picasso for those occasions where we needed … | |
Re: That's because you don't add the new triangle to `triangles` until the mouse is released. Upside down *may* be because y coordinates start at 0 at the top and increase downwards. | |
Re: `println` works by calling `toString()` on each of its arguments in order to get something printable. All classes inherit a `toString()` from `Object`, but all that does is to return the class and hash of the object. Thats what line 21 above will do. You should always override toString in … | |
Re: If this is a "small business at home" then you are over-engineering this to a rdiculous extent. Who are the "receptor" and the "worker" - mom? dad? (not to mention anyone who actually changes tyres!) Just how big is your "home" that you need QR codes and an SQL database … | |
Re: Where you have multiple forms ("views") that need to share data (a "model") you can use Model-View-Controller (MVC) architecture. In simple cases you can ignore the controller and just have a model class or classes that have the data and application logic and view classes that display or input data … | |
Re: The tragedy here is that UI is obviously a highly intelligent and articulate person, but those attributes are being criminally wasted trolling an irrelevant web site when he should be building a demo or proof of concept for his ideas and seeking partners to bring them to fruition. OK, maybe … ![]() | |
Re: > I have given a space of %30s between every field That's not how it works. The width spec is the minimum width to use for the field, not the space between fields. Your format is `"%s %30s %30s %30s"` That means the first item is printed a String with … | |
Re: You have made the fundamental mistake of using a null Layout Manager. By hard-coding pixel coordinates you eliminate any portability to computers with screen resolutions or fonts different from yours. How this is going to play with using a GridBagLayout at the same time is anybody's guess. Line 142 - … | |
Re: I just banned UI for repeated unrepentant irrelevant trolling of valued DaiWeb members. Maybe that will cost me my Moderator badge, but someone had to do something. JC Update: happygeek disagrees. He's an admin and has overridden my ban (as is his right). It's out of my hands now <sigh … ![]() | |
Re: fpru: Forensic Psychiatric Rehabilitation Unit, according to Google. Appropriate? | |
Re: Maybe because you have four ? parameters but you set only 2 of them??? | |
Re: Java is HUGE in scope - I doubt that any Java developer ever knows all its aspects. Have a look at Oracle's Java tutorials - in my opinion the best and only ones worth working with. The overview is [here](https://docs.oracle.com/javase/tutorial/). You definitly need to be familiar with all the stuff … | |
Re: It all depends on how well your original app is structured and documented If you have designed, modularised, and layered it well then you should be able to re-use almost everythinhg except the swing GUI code (ordinary Java is pretty compatible berween SE and Android). Go back to the design … | |
Re: > Still running 30 minutes already... Unless you have some horrendous recursive algorithm, anything more than a few seconds is wrong. Sounds like you have an infinite loop. | |
Re: Your compile error is because "ActionListener(){} must implement the inherited abstract method ActionListener.actionPerformed(ActionEvent)" and you implemented actionperformed(ActionEvent) (Java is case-sensitive) | |
Re: If you are doing a B. Tech. then doesn't that include some element of programming? In which case what language does the first such class use? ![]() | |
Re: I use Opera's as well for browsing, NordVPN for torrenting, geo-fence avoidance etc | |
Re: > I have some idea based on prior research that I need to leave my superclass methods as stubs. No, that's wrong. If you create a method in a subclass that has the same signature (name, return type, parameter types) as a method in the superclass then that's an override. … | |
Re: I don't have an answer - I'm just checking that it's possible to reply now... JC | |
Re: Learning/playing guitar. I've been able to strum along with sing-song stuff since I was a teenager, but now I have more time I'm learning to play proper Jazz guitar. It's really hard, but it does give me a perfect excuse to buy all kinds of super gear... guitars, amps , … | |
Re: There's an active discussion ongoing in S.O. for this question, so there's no need to reply here until/unless OP comes back first. | |
![]() | Re: A perfctly good suggestion, but it would be simpler to let the array elements default to zero, then you wouldn't need to initialise it or add 1 at the end! |
Re: > i haven't figured out how to read the file starting from the third line Just read and discard the first two lines. | |
Re: Read this https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question then start again with all the required content. | |
Re: https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question | |
Re: 26: `double apr = 0;` 30: `HNUnit4Ch13Investor.setInterestRate(apr); ` // sets rate to zero 33: `apr = input.nextDouble();` // this is the real rate, but too late. You never use it | |
Re: I agree you're not going to get rich on up-front pricing, but in-app purchases are a different animal - all you need is a couple of thousand $1 purchases to get your investment back. So maybe your marketing with bloggers etc will fail and nobody will ever hear of, let … | |
Re: Hi Lior You have just joined an old thread about Java programming. If you want relevant answers, please start a new thread of your own, explain what help you want, and tag it with the appropriate language. | |
Re: https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question | |
![]() | Re: The exceptions are referring to a probable problem in `CoinCollection.CoinCategory compare:` Maybe a closer look at that code is needed? |
Re: Hint: What is the largest number you can store in an integer? | |
Re: 1. Read this before posting again https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question 2. We only help people who are making some kind of effort themselves. All you did was to violate your teacher's copyright by posting the whole assignment without any attempt to show any work or even ask a question. 3. No, we are … | |
![]() | Re: If someone has code or a question re Java I'd be happy to see it no matter where they posted it. When we had specific forums for specific topics we didn't have this problem. Now all we have is tumbleweed blowing and settling at random. :( |
Re: This is why Swing has Layout Managers. You start with the components (text fields, drop-down lists, whatever) which Java sizes to fit the text in them - nb this depends on the font you are using and the screen resolution. You use a layout manager to add these to the … | |
Re: Going back to Kernighan & Ritchie... > An array name is a pointer expression ... a reference to an array is converted by the compiler to a pointer to the beginning of the array ... a reference to a[i] can also be written as *(a+i) Obviously this implies that the … | |
Re: Wow. That's really weird. What happens for 17-5-2017, or when you change the end date? | |
Re: Your code says: create some fields open a (modal) message dialog ... (modal dialog waits for user to click OK or close etc) set store name so that's why it sets the store name when you close the dialog If you only want it to update on the save button, … |
The End.