7,116 Posted Topics
Re: [QUOTE=NormR1;1779850]...One thing your code does that might not make sense: It changes the interest rate and the term at the same time How many combinations of computations do you want to do?.[/QUOTE] The spec says: "Modify the mortgage program to display 3 mortgage loans: 7 year at 4.35%, 15 year … | |
Re: You declare im and frame inside the constructor ImageBackGround(), so they can't be accessed from anywhere else. If you want them available to all the methods of that class then declare them in the class but outside any one method. | |
Re: ^ because SleepThread is a Runnable not a Thread, so that's how you create a new Thread for it? | |
Re: In Java there are primitives (int, char, float, byte, boolean) and there are Objects. A HashTable can only contain references to Objects. No primitives and no Objects, just references to Objects. If you try to put an int into a HashTable the compiler automatically creates an Integer Object for you … | |
Re: see: [url]http://en.wikipedia.org/wiki/Hexadecimal[/url] DaniWeb Member Rules include: "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] [url]http://www.daniweb.com/forums/announcement8-2.html[/url] | |
Re: Do you mean that you want the component to grow "slowly", like an animation? | |
Re: If you use printf then you can specify the formats for the printed items, including their width. If you set the width for each field >= longest actual data then the columns will line up (assuming you display them with a mono-spaced font like courier). | |
Re: Sounds like OP may be using null layout (?) - in which case the answer is to use a proper layout manager and a cross platform L&F like Nimbus or whatever you prefer. | |
Re: Example: [CODE]Object[] myArrayOfObjects = new Object[2]; myArrayOfObjects[0] = "Hello"; myArrayOfObjects[1] = new Integer(42);[/CODE] ![]() | |
Re: I haven't time to read all that code, but normally in the actionPerformed you would get the text from the local data entry fields and pass those values as parameters to the insertBotton method. That way the insert class doesn't need to know anything about the data entry fields or … | |
Re: You have detailed instructions. Why not follow them? Start at the beginning: [I]1. Ask the user to enter the number of points. [/I] Then go on to step 2... [I]2. Ask the user to enter x and y positions for each point. Store the positions in a 2-D array. What … | |
Re: The } on line 43 closes the else {, so the print on line 45 is always executed. If you indent your code properly (use a programmer's editor or simple IDE) then this kind of mistake becomes very obvious. | |
Re: Why not just try to connect to the server and see if that works? | |
Re: Why is your forst question a problem? Your code counts 5, does something random, counts on up to 7 then starts again. How is that different from what you want? Which value do you want the user to enter? | |
Re: [url]http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html[/url] | |
Re: [CODE]head = new Product(null, null, 0);[/CODE] Firstly, Product should be an abstract class - it makes no sense to create Product that you don't know whether it's a Book, Movie or Music Secondly, you now have a dummy Product full of nulls at the head of your list, so a … | |
Re: [QUOTE]What I dont understand is that, why do we need to create multiple objects of Cashiers and Products if we can also do the same thing in a single object.[/QUOTE] The basic idea of Object Oriented is that instances of a class represent "real" things. So you have a class … | |
Re: Are you certain that the code you posted is the latest version that you are executing (no old .class files hanging around anywhere?). Are you saying that line 39 outputs a "." but line 44 outputs "null". If both those are yes then I'm baffled... | |
Re: That's very interesting, but without seeing a single line of your code you are unlikely to find anyone clairvoyant enough to tell you what's wrong with it. | |
Re: carProcess is an inner class of roundabout01 (ps - please use standard Java capitalisation to make your code easier to understand). It's not declared static, so just like any other instance member of roundabout01 you need an instance of roundabout01 to qualify any reference to carProcess. Read this next: [url]http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html[/url] … | |
Re: You call it a CryptoSecondaryFrame but actually it's a JPanel - you can't display that unless you add it to a frame or window of some sort. | |
Re: Create two panels, one with the four buttons and a separate panel with the label. Then add both panels to your main panel. This allows you to use different layout managers in each panel to get the exact result you want. Alternatively, you could use a GridBagLayout to do the … | |
Re: You go through the loop (lines 13-19) and do not find a match, so you fall out of the loop with i=21, size=0 Then on line 21 you execute Graph.get(i) with i still equal to 21. The valid indexes are 0-20, so there's your error. | |
Re: Add 1 to the value of the variable "i" in the object "v2" in the object "fd1" That's why choosing good variable names is an essential skill; finding the shortest way to code something isn't. | |
Re: I guess this is where you try to slide? [CODE]for(int i = 0; i < 84; i++) { board[r1][c1].translate(0, -1); repaint(); }[/CODE] Here's your problem. That loop is run in your actionPerformed, which means it runs on the Swing Event Dispatch Thread (EDT). Swing is single-threaded, so there will be … | |
Re: How far have you got? Have you been able to use the code above as a base to find the year for a single pdf and just print it out? If not, that would be a good place to start. | |
Re: This from the junit FAQs may help? [QUOTE]How do I install JUnit? First, download the latest version of JUnit, referred to below as junit.zip. Then install JUnit on your platform of choice: Windows To install JUnit on Windows, follow these steps: Unzip the junit.zip distribution file to a directory referred … | |
Re: Don't confuse variables and objects. A variable is just a reference (pointer),, not an object. You can't "declare an instance". You can only declare variables or create new instances. [ICODE]int[] arr;[/ICODE] declares a reference variable, initially containing a null pointer [ICODE]new int[99][/ICODE] creates an array of 99 ints [ICODE]int[] arr … | |
Re: I'm having to fill in a few blanks in the requirements here, but probably: Think about the real world. You go to a travel agent and they already have a list of destinations. They add you to their customer database, and then you can book a holiday. So in Run … | |
Re: [QUOTE=nidheeshkumar.r;1765044]no..features like texture,color and shape of objects depicted etc...i wanted to search an image on an image database based upon these extracted features...[/QUOTE] I don't want to discourage you, but identifying and encoding info like texture or shape is a really really difficult computational problem, in any language. Is there … | |
Re: That sounds like a HashMap, where you have lots of entries, each entry combines a key (eg "rec") and a value (eg "02"). You can use the keys to access the values. This tutorial is a bit out of date, but it illustrates the basic ideas: [url]http://www.javadeveloper.co.in/java-example/java-hashmap-example.html[/url] | |
Re: That's nearly right... myShapes is declared as an array of Parent objects public Parent myShape[] = new Parent[10]; and, as already said, z is a double. You can't put a double into an an array of Parents. That array can only hold Parent objects, instances of any sub-classes of Parent, … | |
Re: You'll never get past the absolute simplest simple forms without understanding how Swing code works. GUI designers are useful to get some simple layouts & listeners done, but you'll very quickly want more control and want to do more clever things, so you'll end up writing the code anyway. My … | |
Re: The way to get the user input from some text field tf is tf.getText() You have been using getActionCommand, which is something completely different. Actions are a way to have multiple UI events share the same behaviour. As it happens, the action name for a text field it defaults to … | |
Re: The error message tells you which symbol on which line. Wanna share that with us, or should we just guess? OK, line 15 "status" ? | |
Re: OK, I've printed it, but it wasn't very interesting. What next? | |
Re: Have a look at these: [url]http://docs.oracle.com/javase/tutorial/uiswing/components/textarea.html[/url] [url]http://docs.oracle.com/javase/tutorial/uiswing/components/text.html[/url] | |
Re: What's the worry with abstract class constructors? They are perfectly valid and normal. When you instantiate a concrete subclass the superclass constructors will always be called, even if the superclass is abstract. Just try a new B() with these classes: [CODE]abstract class A { A() {System.out.println("A constructor");} abstract void method(); … | |
Re: 1. If there are two loops just because there are two termination conditions then no, one is enough if you AND the two conditions together: while (condition1 && condition2) { ... 2. printf formats have an optional width spec that sets the column width (by left-adding with blanks). Documentation is … | |
Re: I've never tried this but maybe you can create your own TimeZone that has a rawOffset that shifts the date to where you want it to be, then set that custom TimeZone for your program??? | |
Re: [QUOTE]Why does the JApplet not run init first, but default constructor?[/QUOTE] init() is an instance method. It cannot be called without an instance. You can't get an instance without executing a constructor. So there will always be a constructor executed before init(). | |
Re: You could create a Map with process name as key and its status as value. The first time you process a record for a given process name you will add it to the Map with a status of "started". When you find its "finished" record you update the status. When … | |
Re: You can set a compositing rule then draw the second icon with an alpha between 0.0 (totally transparent (invisible)) and 1.0 (not transparent at all (opaque)) [CODE]Graphics2D g2d = (Graphics2D) g; // draw image 1 composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); g2d.setComposite(composite); // draw image 2[/CODE] Have a look at the API … | |
Re: You can OR the expressions together like this c1=='a' || c1 == 'b' ... but if you want a very short version with many tests like that you can use some geeky construct like "abc".indexOf(c1) >= 0 | |
Re: DaniWeb Member Rules include: "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] [url]http://www.daniweb.com/forums/announcement8-2.html[/url] | |
Re: Line 28 looks like the wrong variable is used for the % operation. | |
Re: counter=counter+1; sum=sum+sale[counter]; counter has already been incremented to 1 before you use it the first time. These two statements should be the other way round. (or you could use ejosiah's version, which does the same thing more compactly or cryptically, depending on your experience level). | |
Re: What exactly do you mean by "executables" in a Java context? Java will link to classes in other jars at run time without any difficulty. | |
Re: If you want this to be a learning exercise that builds long-term Java skills then starting with the details of parts of the GUI is leading you down a bad path. You'll end up with mess of spaghetti where the logic of the game is buried in multiple action listeners … | |
Re: What exactly is "frame"? You can't add a Rectangle to any ordinary AWT or Swing container. |
The End.