7,116 Posted Topics
Re: 142: jrbNumBathrooms1.addActionListener(new DisplayButtonListener()); (etc) That's why your radio buttons cause the same actions as the display button | |
Re: An immutable class cannot change any of its values after an instance has been created. eg You can make all its variables private, and don't write any setter methods. Immutable classes can be very efficient becuase the code can assume that no value ever changes. The "con" is that if … | |
Re: That's the default output created by the toString method that every object and array inherits from Object. It means [ this is an array B of bytes 44770739 and that is its unique hash value (very precise, and totally useless!) To convert an array to a useful printable string use … | |
Re: > I have considered eventually hiring an experienced programmer to fine tune everything... Software quality (no matter how you measure that) starts with the specifications and is more or less fixed by the design. If the design is good you can deal with any rough code later, if the design … | |
Re: The wikipedia article on quadratic probing starts with a really clear and simple explanation... | |
Re: What exactly is youer question? There are lots of people here who will freely give their time to help you become the best Java programmer you can be, but there's nobody here who is interested in doing your homework. DaniWeb Member Rules (which you agreed to when you signed up) … | |
Re: > I was always under the impression that this forum was to be a source of inspiration and a source for helping others. Yes, indeed it is. But's not a place that does people's homework. We always expect people to show real effort if they want us to give our … | |
Re: This is a three year old thread. DaniWeb Member Rules include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question ![]() | |
Re: csv is a text file format. What kind of pie chart do you want to add to a text file? If you want a proper graphic pie chart then you will have to use a more capable file format, eg pdf. | |
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: Most versions of this seems to be pre-OO indesign, with lots of arrays and no classes. Maybe this is a gmood time to do it in proper OO style? I haven't done this myself, but of I were to try, I would start with a Cell class. That makes it … | |
Re: I can't see where you have added the action listener to the buttons. It would be easy to do that in the Buttons constructor. http://docs.oracle.com/javase/7/docs/api/javax/swing/AbstractButton.html#addActionListener%28java.awt.event.ActionListener%29 | |
Re: Where do you add jpan to your tabbed pane? | |
Re: gavinflud: Here at DaniWeb we try to help people learn Java and develop their Java skills. We do NOT do people's homework for them. In future please help by pointing people in the right direction - eg tell them which classes and methods they should read about, or give them … | |
Re: A checksum seems a good idea, MD5 SHA, that kind of thing. Have a look at the[ MessageDigest class](http://docs.oracle.com/javase/7/docs/api/java/security/MessageDigest.html) It's simple to use, but you'll find example code on the web as well. | |
Re: radhakrishna.p Here at DaniWeb we try to help people learn Java and develop their Java skills. Your post explains and teaches nothing. In future please help by pointing people in the right direction - eg tell them why their code is going wrong, or which classes and methods they should … | |
Re: @subramanya: This is an exercise in the use of generics. All you have done is to remove the generics from his code. | |
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: Animation in Java is pretty straightforward, good fun, and can work really well, at least in 2D. There's great scope for modelling physics - gravity, friction, things bouncing off each other... See also http://www.daniweb.com/software-development/java/threads/430542/java-projects-for-learners | |
Re: DaniWeb Member Rules include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question | |
Re: Welcome, and we all wish you great success with your project. Without knowing more about your current level of expertise its hard to offer relevant advice, but maybe these two mantras will add to the obvious O.O. stuff... *Test early and test often.* Depending on your experience level try to … | |
Re: You can use a static counter variable in any class to see how many you have created - just increment the counter in the class's constructor, eg class Demo { static int counter = 0; public Demo() { ... normal constructor code counter++ } Then you can use that like … | |
Re: It depends on whether the methods in myFunctions are static or not. (They probably should be static). If they are static you call them with the class name, eg `myFunctions.sin` If not, then see radhakrishna's post above. ps Java naming comventions: class names should begin with a capital letter | |
Re: Like it says, there is no sort method in the Arrays class that takes an int[] and a Comparator as parameters. Why did you think that there was such a method? | |
Re: Sparate GUI and model logic to avoid one gigantic sphagetti of code. Develop the simulation logic (model) first, testing it with simple hard-coded test case data and print statements. When it's working add the GUI. Sprite animation sounds appropriate, each sprite can be linked to a Vehicle in the simulation … | |
Re: The answer depends on how the four classes are related. Do any extend any others? Do the other three have a reference to the fist class instance? | |
Re: All of your drawing code MUST be in the paintComponent method. That's the only place where you have access to the correct Graphics environment, and where Swing will handle the changes to the Graphics properly. All you can do in your mouse listener(s) is to update some variables that keep … | |
Re: 1. Your Peson instance needs reference to an instance of Basket, eg Basket myBasket = new Basket(); then you can call its voegToe method to add an Article, eg myBasket.add(new Article(some suitable parameters)); | |
Re: See http://javarevisited.blogspot.fr/2011/05/example-of-arraylist-in-java-tutorial.html | |
Re: Thread sleep isn't a good way to go, the Java API includes Timer classes that you can use to schedule updates to your animation at regular intervals. The paint looks OK. Here's the simplest possible runnable example of a good approach import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Animation0 … | |
Re: Obviously you can't run the program if it didn't compile! When you ***compiled*** the program it found an error and will have given you a detailed error mesage explaining what was wrong. What did that say? | |
Re: What happends if hint is none of low/high/correct? It executes none of your return statements and drops down to line 17 without returning an int. | |
Re: Does your classpath include the directory with the same name as the top-level package? | |
Re: Is this a question about using the Java programming language (not Javascript)? | |
Re: Line 12 you appear to be trying to declare a new int inside the switch - obviously an error. Anyway, each case looks like switch (index) ... case n: if (index == (n-1)) ... so you can guarantee that every if test will be false and nothing will ever be … | |
Re: Just look on the web. You will find many tutorials on classes and objects. It's not realistic to expect someone here to write a new tutorial just for you. DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself … | |
Re: A small point: although the declaration syntax `int arr[]` is perfectly valid, most standards prefer the form `int[] arr` That's the form you will find throughout the Java API source code. The reason is that arr is an array of ints, as implied by the second form. The first form … | |
Re: In Java you have variables and expressions that refer to objects or arrays. "null" is the special value for those variables or expressions that have not been initialised to refer to a real object or array - it means that they refer to nothing. eg `String s;` declares a variable … | |
Re: > you can't make for loop that will run for given double variable,you can't say that your loop executes 4.7 times..so in for loop there is only integer variable you can put. Sorry, that's not true. There's absolutely no problem using a double for a loop variable like that, as … | |
Re: You can't "replace it with null string" in an int array. For int arrays all you can do is to chose some value to represent elements that do not have a user value in them. Integer.MIN_VALUE could be a good choice. | |
Re: The standard compiler is javac.exe which is part of the [JDK download](http://www.oracle.com/technetwork/java/javase/downloads/index.html) But if you have been using Eclipse maybe you should download the latest version and carry on. Eclipse is definitely a full industrial-strength piece of software, and doesn't break easily. | |
Re: You haven't had any answers yet. That's probably because the question is too vague. Try to explain exactly what you are trying to do, what code you have tried, what error messages you have got etc. | |
Re: There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) … | |
Re: Assuming the inner polygons have their coordinates defined in the same frame as the outer one (as ooposed to being relative to the outer polygon) then all you need to do is to apply the same absolute transform you used on the outer polygon's coordinates | |
Re: Print each of the variables/expressions on that line to see which is null. | |
Re: You will go round the while loop up to 3 times, and you need a new roll of the dice each time, so the` nu = 1+ rollOne.nextInt(12);` must be insde the loop. ps: that line is not an accurate model of rolling two dice. There's only one way to … | |
Re: Daniweb member rules include "Do ensure that all posts contain relevant content and substance and are not simply vehicles for external links" We also discourage people from simp/ky posting complete solutions.In future please help by pointing people in the right direction. | |
Re: You have not explained how you would like the panel laid out - you just said that centrally aligned is a "problem". Nobody can tell you how to write the code for an unknown layout! ;) | |
Re: The Random class is a random number generator. It can generate all kinds of random values, eg ints, gaussian distributed doubles, arrays of random bytes etc. new Random() gives you a new random number generator - not a randon number, but a random nunber *generator*. You then use that to … | |
Re: First a point of terminology: there's no such thing as an "anonymous outer class". Only inner classes can be anonymous. Anyway, "yes" to both your questions. You have to create an instance of the outer class before you can create an instance of the inner class (unless the inner class … |
The End.