7,116 Posted Topics
Re: Your test method includes the perfectly reasonable line [CODE]Rectangle rtg = new Rectangle(10, 5);[/CODE] this will look for a constructor of the Rectangle class that takes two numbers as parameters, and that's exactly what this is: [CODE] public Rectangle(double length, double breadth){ this.length = length; this.breadth = breadth; }[/CODE] Like … | |
Re: I don't know what you intended for line 3, but enum MenuOptions currentPrompt { BILLING, FORECLOSURE, LISTING, FINANCING, HR, AGENT } is not a valid enum declaration. You can't have 2 names like that after the enum keyword. | |
Re: I'm going to (respectfully) disagree with the previous 2 posts. Using NetBeans or another IDE to generate Swing code when you don't understand Swing will just lead you into more and more confusion. You'll get hundreds of lines of code that almost but not quite work, and you'll have no … | |
Re: The doc for NoSuchMethodError says "Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed." Try deleting all your compiled .class files and re-compile everything. | |
Re: The if test can't cause that problem. [B]Exactly [/B]what error message do you get? | |
Re: In main you set up a billboard, then around line 45 you enter an infinite loop getting input from the user, copying it to a local variable, and doing nothing with it. It doesn't display anything because you don't execute any code that could display something. Ohn the other hand … | |
Re: You just need to compare the year/month/day (in that order) from the current date and the date that's passed as a parameter | |
Re: [CODE]public double getSalesTotal(double salesTotal) { salesTotal = purchaseTotal; }[/CODE] You got yourself quite confused about get methods. You don't need to pass in the value if the purpose of the method is to get it! And setting the value of a parameter like that doesn't achieve anything anyway. A typical … | |
Re: You don't normally create your own, but Java windows have them automatically. It just simplifies things to separate the border from the contents. See the second part (swing) of this tutorial... [url]http://java.sun.com/products/jfc/tsc/articles/painting/[/url] Before Java 1.5 you had to mess about adding components and setting layout managers for the content panel, … | |
Re: This is a topic close to my heart, but it's hard to comment without knowing more about your code - sometimes people get the threading model wrong, sometimes its as simple as re-reading image files each time the GUI updates. Can you post the relevant parts of your code? | |
Re: Do you want it to keep on showing a new random face at regular intervals? If so, use a javax.swing.Timer to call your roll() method with a suitable interval: [url]http://download.oracle.com/javase/tutorial/uiswing/misc/timer.html[/url] | |
Re: [QUOTE=Prateek nandan;1667457]string can never be assigned directly... you can use for loop.. for(int i=0;i<name1.length();i++) name[i]=name1.charAt(i);[/QUOTE] Unless I have completely misunderstood this post... it's complete nonsense. | |
Re: You add a drawclass and call its method, but that draws nothing. The drawing code is in class Moon. | |
Re: Each read method has its own way of signalling EOF when you attempt to read past the end of file, eg returning -1 for the number of bytes read. Because some read methods return (eg) Strings don't return a number, they have to signal EOF some other way, such as … | |
Re: You don't add all those individual items to the tree, you add a single person object that contains all those values. ie: You've got a name a dob, so you can create a new Person object with those values, and add the new Person object to the tree. | |
Re: What's that arrayCopy intended to do? You may get some small gain from less index calculation if you use a 1D array, but if that means you are having to calculate indexes yourself then that would be worse. In the end only a benchmark will tell you for sure. | |
Re: DaniWeb Member Rules: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" [url]http://www.daniweb.com/forums/faq.php?faq=daniweb_policies[/url] ![]() | |
Re: That's a perfectly reasonable way to do it, but this being Java please use a boolean array, not a numeric array with 0/1 values. | |
Re: "crashes" tells us nothing. Do you get an error or Exception message? If so please post the whole thing, including the line number(s). EDIT: Sorry sorry sorry - just went back to main forum listing and saw your post's title. Sorry. I'm looking at the problem now... Line 111, why … | |
Re: No, the first statement assigns a value to answer, the following 3 [B]replace [/B]it. You need something like[CODE]answer = answer + "(" + values[i] + ""; // + is String concatenation[/CODE] which can be written more concisely as[CODE]answer += "(" + values[i] + "";[/CODE] Your method signature is[CODE]public String markRuns()[/CODE] … | |
Re: Isn't it just maxRange/X? ![]() | |
Re: If you have Java 6 (which you should by now) there is a new facility for displaying a startup screen even before your code starts to execute, and updating it with progress: [url]http://192.9.162.55/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/[/url] | |
Re: I've found Visual Paradigm to be pretty useful. It has a "Community Edition", free for non-commercial use. [url]http://www.visual-paradigm.com[/url] | |
Re: Member rules: Do not post the same question multiple times | |
Re: [ICODE]letter == "V"[/ICODE] The == tests for letter and "V" both being exactly the same Object, which they are not, so it's always false. To test whether two string Objects contain the same sequence of characters you need the equals method, as in [ICODE]letter.equals("V")[/ICODE] | |
Re: The requirement states "the number of the month which was last constructed.", so I would suggest updating it in the constructor(s) not in the set... method. | |
Re: I see this is your first post, so please check out the DaniWeb member rules before you go any further and get a moderator on your neck! DaniWeb Member Rules include: "Do not hijack old threads by posting a new question as a reply to an old one" "Do provide … | |
Re: Method definition: [CODE] public void giveDollars (int dollars)[/CODE] Method call: [CODE] register.giveDollars());[/CODE] Number and types of parameters should match. | |
Re: You are confusing bytes that represent characters, eg '1'. '2' and bytes that contain a binary number eg 1, 2 Your option = scan.nextByte() will give you the ASCII code for '1' (etc), which is a numeric value of about 49 if I remember correctly. | |
Re: You define a BlockingQueue without specifying what kind of Objects can go in the Queue, so it defaults to any Object. You add an int, and the compiler kindly converts that to an Integer for you. But when you try to take things from the queue all that Java knows … | |
| |
Re: "\n" isn't a command, it's just a new line character and you can use it in Strings just like you use "A" or "B". So, for example, the String "ABC\nDEF" is a valid String that when printed would look like this: ABC DEF Of course you could print it to … | |
Re: [QUOTE=techyworld;1664332]whats wrong in the program?[/QUOTE] Your recursive method works for me (assuming y>=1). | |
Re: Do you mean to declare an array[26][5] so you can access individual elements with syntax like array['a'][2]? | |
Re: DaniWeb Member Rules: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" [url]http://www.daniweb.com/forums/faq.php?faq=daniweb_policies[/url] | |
Re: ...or... use nested arraylists ArrayList<ArrayList<String>> rows and access the inner ArrayLists, and their Strings in the usual way. | |
Re: I have no idea if this is relevant, but your [ICODE]form.setVisible(true);[/ICODE] seems at best redundant because the JFrame subclass to which it refers hasn't been populated or configured in any way. | |
Re: This isn't an attempt to violate the DaniWeb rule that says "Do not ask for help to pursue any illegal activity including, but not limited to, hacking..." is it? | |
Re: Don't know what VB has to do with Java syntax. In Java the {} thing is to define a literal array, eg [CODE]int[] a = {1,2,3};[/CODE] To assign one element of an array to another its just [CODE]a[i] = b[j];[/CODE] | |
Re: You could subclass TreeCellRenderer and use setCellRenderer(javax.swing.tree.TreeCellRenderer) to draw each row with any arbitrary height, and setRowHeight(0) so the the current cell renderer is queried for each row's height. | |
Re: [QUOTE=Taywin;1662153]Hmm... How about using "char" array of size 10^6? A char is size of byte which should be more than enough to hold that many digits?[/QUOTE] A Java char is 2 bytes. | |
Re: You set i on line 15, but then overwrite that on line 19 without having ever used the first value! Replace line 31 with [ICODE] e.printStackTrace();[/ICODE] so that you know exactly what the error was and exactly where it happened | |
Re: Hi javaflasher. No disrespect, but have you checked a calendar recently? That problem was posted March 3rd. The OP will have either solved it or given up many months ago. | |
Re: [CODE]public void display(){ for(int i = 0; i<count; i++){ System.out.println(numofcd[numCD].toString(numCD));[/CODE] Shouldn't you use i to index into the array? | |
Re: That's Java for you. Switches are for integer values and enums only, plus Strings if you are on Java 7. | |
Re: When you instantiate an array of Object references in Java, the array [B][I]is[/I][/B] initially full of nulls. (If you don't believe me try printing element[0] of a newly initialised object array) | |
Re: If you just need some test data you can create and populate an int array like this: [CODE]int[] arr = {1,2,3,999}; // creates 4 element array with those values[/CODE] | |
Re: [QUOTE=jeanrlavoie;1662578]I agree that java 1.7 will be released. It's on beta now.[/QUOTE] Wrong. Java 7 was fully released and made generally available July 28th 2011 Java 7 is the current release version. [url]http://www.oracle.com/technetwork/java/javase/downloads/index.html[/url] [url]http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-429209.html[/url] | |
Re: SquareBaseContainer is abstract so you can't instantiate it. Eclipse is just following the Java language definition correctly. |
The End.