7,116 Posted Topics
Re: You know how to write one line (its in your code at line 59), so all you need to do is to place that inside your loop(s) so that its executed for each line that you read from the input files. | |
Re: Jamie - this thread is 9 years old and SelArom has not been here in the last 7 years, so don't wait for an answer. | |
Re: I have absolutely no idea what that code is supposed to do, and I don't suppose many other people will either. Can you explain what it is supposed to do, maybe with a small example or two of correct input and output? | |
Re: There is only one way to create a text box in Java, and that is to dynamically create a new instance at run time. So what exactly is your question? | |
![]() | Re: http://bfy.tw/4hKQ |
Re: OK. Firstly there's a translation problem. "bolt" has no relevant meaning in English. Secondly, you post two pieces of code that have absolutely no connection or variables in common. You need to post a lot more of your code, so we can see how these two pieces relate to each … | |
Re: What code did you try? | |
Re: You don't test to see if the check boxes are checked ( `isSelected()` ), you just get their text (which you knew anyway) | |
Re: DId you use NetBeans? If its set up right it keeps the previous versions of all your source code. | |
Re: Looks like you messed up your brackets. At line 66 you are still in the QuestionListener inner class, wheras I expect you inetnded to close that class definition first and have `main` as a method of the Question1 class. ps: Always use your IDE's formatting to indent your code correctly. … | |
Re: There's nothing wrong with what you are doing. It happens all the time, eg Employee has a subclass Manager (inheritance) Every Employee has a Manager (composition) Every Manager manages (has) several Employees (composition) technically only one of those composition relationships needs to be held, and holding them both does pose … | |
Re: You start by chosing a game! If you can't think of one then try searching the web. | |
Re: Forget thread and sleep - it doesn't work well in a GUI You need a Swing Timer that will update your GUI at regular intervals. Here's a couple of tutorials: https://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html http://www.javacoderanch.com/how-to-use-swing-timer-class.html | |
Re: You call the getters OK, but you don't do anything with the JButtons that they return. In your original code you used public variables to refer to the radio buttons. Now you just need to replace those public variables by calls to the getter methods. At the same time you … | |
Re: Don't forget that `/*` can appear inside a line comment, and thus may not have a matching `*/` `//* this is a valid Java comment without a closing delimiter` And `/*` or `//` can appear inside a String constant `String s = "/* this is not a comment"; /* but … | |
Re: 16 mSec is 1/60 second. That's the clock resolution on simple computers. If your PC has a more accurate timer you can get it via System.nanoTime() YOu didn't say wats wromg with your file reading, but your code will skip the first line. | |
Re: And I bet he'll be really happy to get an answer that fails to meet the stated requirement for a recursive solution. | |
Re: Conway's Game of Life is good fun and has lots of graphical potential (eg a drag'n'drop library of interesting known shapes) | |
Re: Yes. Its your graphics hardware, not the CPUs. A 2.4 i5 will be perfectly adequate with a decent graphics card. One of my machines has HD3000 graphics. Its fine for ordinary "business" use, but hopeless for real-time 3d games. | |
Re: Thank you for posting your assignment - I'm assume your teacher gave you permission to post their intellectual property on a public web site? You don't seem to know whqat language it shoud be written in. You obviously didn't read the DaniWeb rules that you signed up to - including … | |
Re: Hericles has the right analysis, but the solution is simpler than he suggests. Here's a hint that should get you thinking in the right direction: What happens when you call this method passing an empty list (ie top == null)? Can you fix both problems by just deleting one small … | |
Re: No, it would not be benificial at all. Cheating by using someone else's answers is an insult to the original author and an insult to your teacher. Do your own homework. | |
Re: Hi Adnan I suspect the reason why you have no replies yet is that the problem specification seems odd. Step 4 says "compare the elements using a loop", but you can only s do it with a single loop if you need to match the numbers *and their positions*, which … | |
Re: I think you are wrong about randomHelper. It's crazy to ignore a known problem while looking for an unknown one. Track down and fix that problem before moving on. Maybe it's irrelevant to the one you're worrying about, but maybe not. | |
Re: If the term you are searching for can be anywhere in the sentence, then sorting isn't going to relevant, and binary search won't help. If you will always be searchng for whole words, then maybe you could parse out all the words in each sentence and build some kind of … | |
Re: Apparently you can keep it switched on until the battery is completely flat. | |
Re: When you execute the join your thread. Is suspended, so the finally is not executed then. When projectDCThread dies execution of your code will continue and the finally should be executed | |
Re: It' looks like a method. Which class did you find it in? According to the JLS goto is a reserved word, so the answer to "what use is goto(x,y)?" Is "you use it generate a compile-time error". | |
Re: If your teacher told you that then (s)he obviously thinks you should be able to do it. If you get stuck on a particular point then people here will help you. Just saying "I need help" will get you nowhere. | |
![]() | Re: An operating system like Linux, Windows, OSX, iOS etc? That's a massive project. What are your goals? How will you know when you have succeeded? |
Re: I guess you know the story of the ArIane 5 rocket? Cost a gazillion Euros and blew up soon after launch. The guidance software had an assignment of a 64 bit number to a 16 bit target. Of course the compiler objected, but management reviewed the problem and decided the … | |
Re: Bonjour Mounime Don't hijack old threads, start your own. Don't just post code, explain exactly what is your question | |
Re: Doing a getGraphics and drawing to that will never work. You have to cooperate with Swing's double buffering. The ONLY way to draw in Swing is to override paintComponent. I would post you an example, but I'm away from my usual machine right now. There's an article on Oracle's site … | |
Re: There's no sensible shortcut for this kind of thing, but the code you posted has an incorrect second loop and uses the same value for every field. Ignoring the parseInts it should look like for (String[] record : csvArray) setFirstField(record[0]); setSecondField(record[1]); Etc Ps please excuse garbled code, I'm on an … | |
Re: What help do you need? What have you done so far? The more effort you put in, the more people will help (and vice-versa) | |
Re: Look at the constructors for ClassParser. You are using the one that takes an input stream, which you get from you current class loader. It would be a lot easier to use the constructor that takes a file name, or if your class is in a jar, the one that … | |
Re: I googled for de.vorb.leptonica+jar+download and it was the first hit | |
Re: I've a horrible feeling that that was all he was asking for (although a simple \n would have been sufficient). Yash : we don't do people's homework for them, but we will help people to do it themselves. It's up to you. | |
Re: If you google "Java OCR " (optical character recognition) you will find a good number of libraries, some of which are open source. On the other hand, if you are trying to automate CAPTCHA recognition then Daniweb TOS prohibits such discussions here. | |
| |
Re: I don't know c++, but maybe the Jave equivalent would be to declare an interface. Interfaces contain method signatures but not their implementation (Java 8 changed that a but, but let's not worry about it now). Then when you later define a class you declare the class as implementing that … | |
Re: You get excellent by writing lots of code. There's no other way. If your Java is good enough you could join an open source project on GitHub or source forge etc. If you're not ready for that yet, then practice using the suggested small projects for learners that you can … | |
Re: What help do you need exactly? Where are you stuck? | |
Re: The easiest way is to use a blocking queue that supports multiple producers and consumers, and handles its own thread safety. See the apPI doc https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingQueue.html | |
Re: In Java hash algorithms are subclasses of `MessageDigest`. If you google Java MessageDigest you'll find lots of docs and examples. | |
Re: <edit> - removed incorrect comment </edit> In `alterMatrix` you create and populate `myNewMatrix` but you never do anything with it. | |
Re: I would say, for while loops if the loop depends on a number of things being true (eg more data waiting, no errors found, server available), then AND is needed | |
Re: I find that code very hard to read, but looking at the matching around line 78 it looks like you are testing if the chars from the two DNA strings are the same, not T matches A etc | |
Re: Ditto. If all the values are held to 2 decimal places then consider using int variables in units of 1/100. (ie replace float 1.55 with int 155). Then, and only then, can you compare for equals. (And don't forget = is assignment, == is equality operator) | |
Re: You also have a problem on line 25. As soon as this is executed it will return from the current method - which is the `main` method, so your program will then terminate without processing any more numbers. Your code will be almost un-debuggable if you persist on incorrect indentation. … |
The End.