7,116 Posted Topics
Re: You downloaded a compiled program, decmpiled it with the intention of changing it in order to put it online? This sounds too much like a copyright issue. Do ensure you own the intellectual property rights to everything that you post Do not post copyright-infringing material Do not ask for help … | |
Re: Don't reload the image file every time. Do it just once at startup and keep a copy. | |
Re: At the start you don't know how many evens and odds there may be, so you can build up two Strings as you process the numbers and print them only at the end - like this pseudocode: evens = "", odds = ""; for each number in the input { … | |
Re: Java is case-sensitive. string and String are not the same. String is a class name and is spelled with a capital S | |
Re: If OP really doesn't have sufficient ability or initiative to find information on prime number programs on the web then simply giving them something to copy & paste into their homework is helping nobody. Not their teacher, not a potential employer, not their hard working colleagues, and least of all … | |
Re: Your random numbers are in the range 0-12 so your first loop will never be able to process 14 letters, but it keeps on trying... Ps. Your second loop will never select Z, for the same reason. It seems you have mistaken the contract for nextInt - review the API … | |
Re: Since your resultSetToTableModel isn't part of the standard Java API its hard to know how solid it is. Did you try printing from your result set to confirm that it has some data in it? | |
Re: As Oracle keep improving Java, there are times when old classes and methods get replaced by newer better versions. The old versions are still there, so existing programs will continue to work, but they are marked as "deprecated" to tell programmers that they should replace or upgrade their code. If … | |
Re: You ask rhe user for a number between 0 and 1.00, but you read his reply as an int - which has no decimal places | |
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: the get and the remove are not nested, so you don't multiply them together. Think of it as O N*(N+N) ie O N^2 (Of course, if the list implementation is suitably optimised then get(i+1) immediately following a get(i) could be constant and small. Similarly get(i) followed by remove(i) could be … | |
Re: You changed adding the label. You add yours at the default location (CENTER), which is where the paint area was. The original code adds it at SOUTH so there is no clash. ps: Next time please provide a lot more info to describe your problem, eg exactly what do you … | |
Re: Start by readingb this: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html | |
Re: As far as I know you can't insert into two tables with one SQL insert statement, so you need to prepare two statements, set all their strings, and execute them both. You may need to wrap them in a transaction if you are worried about database integrity after a partial … | |
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 | |
![]() | Re: Forget Java for a moment. Get a sheet of paper and a pen and work through a simple example (eg array length 3) by hand. That will get the algorithm clear in your head, and you will find it easier to convert that into Java code. |
Re: Are you looking for books etc, or do you have books etc that you want to promote? | |
Re: You have not defined a drawPool method, swo obviously you cannot call it! You need to write a method that will use one or more draw... methods from the Graphics class to draw the pool cross-section - eg call *drawLine* four times to draw the top surface, botton, deep end … | |
Re: Post the code here - don't expect people to go looking for it somewhere else. | |
Re: All you need to know is: it's optional to catch an unchecked exception; if you do catch it you execute whatever is in the catch block; if you don't catch it it is thrown back up to the method that called the current method. eg When april calls e if … | |
Re: Well, OK, you can do that. If this is a follow-on to you still unsolved "handling large files" topic then messing about with how you read the logs isn't going to make any real difference - it's the SQL that needs to be optimised. You may get the best throughput … | |
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: It's hard to see how you could get a divide by zero when k starts at 2 and goes up... try putting some print statenents into that loop to show the values of randomNumber and k so you can see what's happening. | |
Re: Looks like the package org/jfree/util isn't in your classpath | |
Re: > java.lang.StringIndexOutOfBoundsException: String index out of range: 1 > at java.lang.String.charAt(Unknown Source) > at app.SearchByKey.SearchStudentNumber.SearchStudentRecordReader(SearchStudentNumber.java:38) That's not a null reference. It's an attempt to get a char from a String that doesn't have enough characters in it. Specifically you are trying to acccess the second character (index number 1, the … | |
Re: Don't confuse variables and objects; your example contains both. `List<Integer> lst` declares a variable. It's a reference, just a few bytes regardless of what it refers to. If it's a local variable it will be allocated when it comes into scope and released when it goes out of scope. If … | |
Re: You need to study how viruses work first, then look at how existing antivirus programs work. Its not easy, and needs a really deep understanding of the operating system. In any case, Java is completely the wrong tool for this job. It's designed to be independent of any one operating … | |
Re: You are looking for "cat ", so if the input is "cat" it won't match. Anyway, your algorithm would also find "muscat ", so it's not perfect. You are using Scanner's next() method - what happens if the input is more than one word? Line 11 doesn't do anything (more … | |
Re: Never NEVER *NEVER* do this when writing new code: } catch (Exception e) { } If/when there is an error you just told Java that you didn't want to know anything about it, and please discard the detailed error message that Java just created for you. ALWAYS put an e.printStackTrace(); … | |
Re: Without seeing your code its impossible to say what's wrong with it. | |
Re: You didn't say what your qestion/problem was. But if that's one file... every public class must be in its own .java file, and the name of that file must be the name of the class. You therefore cannot have two public classes in one file. | |
Re: What do you nean by a "long time" - how many lines per second is it averaging (very rough answer is OK)? | |
Re: You are using a null layout manager for some reason - I suppose you are aware that this kills your portability - as soon as you run the code on any other machine with a different screen res / font size your text won't fit properly. Anyway, getPreferredSize is called … | |
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: Lines 8,9,10 are redundant - a single Education object contains values for degree, major and research, so all you need is a single instance of Education - let's call that variable "education" for the moment, and assume you initialise it with a complete instance of each Faculty's Education. Now on … | |
Re: Your code uses classes that are not in the standard Java API, so we have no way of knowing what the method calls do, or what the types of any return values are. That makes it near impossible to comment on the code. See http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html for a list of the … | |
| |
Re: Benjamin. I appreciate that you are trying ot help, but here at DaniWeb we try to help people learn Java and develop their Java skills. We do NOT do people's homework for them. Your post explains and teaches nothing. In future please help by pointing people in the right direction … | |
Re: That all looks sensible. In general you need to test for null first, then if it's not null you can test for an empty String - if you want to treat a blank string as being empty, then use trim() first. getText returns a String, so the toString() is not … | |
Re: Look through the messages until you find a reference to your code, in this case `at PBT$1.actionPerformed(PBT.java:103)` then look at that line `103 int pr1=Integer.parseInt(presentation1Tf.getText());` now you can undestand the error message `NumberFormatException: For input string: ""` presentation1Tf contained no text, and you tried to parse that as an int | |
Re: > is there better way to do this by using recursion? may be there is some formula that i dont know about. Instead of just `true/false` you could define the method to return three values for `to small/just right/ too big` (eg see the Comparator interface in the API). Then … | |
Re: mKorbel: Hi. What's the easiest way you know to use a JFormattedTextField for the input in a JOptionPane InputDialog? | |
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: Hi Nikolas. Welcome to DaniWeb. eldiablo1121 is a beginner and has been struggling withy this assignment for some time. Do you really think that dumping 8 lines of highly compacted uncommented code is going to help him? In the worst case he will copy/paste/use that without understanding it, and thus … | |
Re: The API shows the nuber of bits in a BigInteger to be both set and returned as an int, so the limit is 2^31 bits. That is part of the public API conrtract of the class, and is thus guaranteed. (It should also be within the memory size of a … | |
Re: The fully-qualified name of that class is `java.util.Arrays` so either use the fully qualified name, OR (and this is what people usually do) import it at the beginning of your program just like you did with ArrayList or Scanner `import java.util.Arrays;` ps all the java.lang classes (eg String) are automatically … | |
Re: You can also use System.getProperty to get the user's home directory (and other useful places) in an OS-independent way, so that may be a good way to specify a location that should work under any OS. http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html | |
Re: Yes. String's `format` method uses `java.util.Formatter` format specs (based on C's printf) to format data into strings with specified padding, decimal places etc etc etc | |
Re: Hello rereye 1. Please do not hijack other people's posts for your question. Start your own new topic. 2. 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 … | |
Re: That's a nice demo of using a panel in a standard dialog. Thank you. ps String password = new String(pf.getPassword()); if (password.equals("admin")) { test = true; } else { test = false; } OR just String password = pf.getPassword(); test = password.equals("admin"); |
The End.