Forum: Java May 6th, 2009 |
| Replies: 12 Views: 533 As far as the name part goes, you could have your box constructor also take a string variable, which is the team name. Then you could use the drawText method to draw the team name, linking the... |
Forum: Java May 2nd, 2009 |
| Replies: 2 Views: 301 You use a for loop in your increment method, so it prints out both lines. Removing the for loop and using a simple println will take out the duplicated line. Just be sure to increment the day.
... |
Forum: Java Apr 27th, 2009 |
| Replies: 6 Views: 275 There will be no code. This isn't a homework completion service.
Post the code you started or ask direct questions, no one here will do the work for you, but they will help you if you ask the... |
Forum: Java Apr 15th, 2009 |
| Replies: 6 Views: 666 So, a superscript?
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/font/TextAttribute.html May be of use. |
Forum: Java Apr 8th, 2009 |
| Replies: 19 Views: 776 Constructor for class video would appear as:
public Video(String name, int rating)
{
///store name and rating to instance fields
}
Then you would have methods such as:
public String... |
Forum: Java Apr 8th, 2009 |
| Replies: 19 Views: 776 What it appears you need to do is simply create one array, of type Video. Video will be a class you have to write, simple enough: Constructor with the two parameters and then return methods.
Once... |
Forum: Java Apr 8th, 2009 |
| Replies: 15 Views: 1,160 I was just trying to stem any confusion. I think we can all drop this topic, doesn't look like the starter is interested. |
Forum: Java Apr 7th, 2009 |
| Replies: 15 Views: 1,160 He mentions needing to use a for loop, not recursion. At least that is how I took it.
Taking user input is easily done using a Scanner. |
Forum: Java Nov 17th, 2008 |
| Replies: 3 Views: 641 Is there a way to modify this code so that a elements that would go beyond the frame appear on a new line instead? And also so that the next button iterates the count inside the square, but does not... |
Forum: Java Nov 15th, 2008 |
| Replies: 3 Views: 641 "Write a program to display a linked list graphically. Draw each element of the list as a box, and indicate the links with line segments. Draw an iterator as in Figure 15-3. Supply buttons to move... |
Forum: Java Aug 14th, 2008 |
| Replies: 26 Views: 3,897 Would recursion make this problem any easier? |
Forum: Java Aug 14th, 2008 |
| Replies: 26 Views: 3,897 As I'm not sure how to implement the rotate method, I went back to try to get the calculations right. Unfortunately, I have not got it correct. My updated code:
import java.awt.Graphics;
import... |
Forum: Java Aug 13th, 2008 |
| Replies: 26 Views: 3,897 Adding Grapics2D to the getKochPoints method would seem to cause numerous problems however. Then the calling of the method would have to be changed as well, and that method doesn't support graphics... |
Forum: Java Aug 13th, 2008 |
| Replies: 26 Views: 3,897 An idea that failed miserably. I can't seem to get the rotate(double) method to work at all. It tells me it can't find the method. I thought it was part of the Graphics2D package?
I'm probably... |
Forum: Java Aug 13th, 2008 |
| Replies: 26 Views: 3,897 Hmm, I don't see how rotate would be applied, unless you rotate polygon.... Well, there's an idea. |
Forum: Java Aug 13th, 2008 |
| Replies: 26 Views: 3,897 I'm not sure if it will or not, and my professor is currently out of contact.
Which class are those methods from? Just from the names I can't really see how you'd use them for this. |
Forum: Java Aug 13th, 2008 |
| Replies: 26 Views: 3,897 Is this calculation different for each side? Like I was doing? |
Forum: Java Aug 13th, 2008 |
| Replies: 26 Views: 3,897 So, after toying with the code you gave me, I've run into a problem. While I can supposedly get the next iteration to appear, all the others after that are incorrect.
import java.awt.Graphics;... |
Forum: Java Aug 12th, 2008 |
| Replies: 26 Views: 3,897 Ahh, that makes more sense. Thanks. |
Forum: Java Aug 12th, 2008 |
| Replies: 26 Views: 3,897 Your code here seems to use a class Point. Yes? |
Forum: Java Jul 22nd, 2008 |
| Replies: 26 Views: 3,897 Very. I can't for the life of me see why it does this. |
Forum: Java Jul 22nd, 2008 |
| Replies: 26 Views: 3,897 I placed int variables in the draw method, and the paint method that are derived from the size of arrylist x. After draw is done being called, the size is 6. After the program moves on to paint, the... |
Forum: Java Jul 21st, 2008 |
| Replies: 22 Views: 2,313 This is what is printed to the text document. After I fixed the names of the objects so i was printing the right ones. |
Forum: Java Jul 21st, 2008 |
| Replies: 22 Views: 2,313 I modified each constructor class, and the main class. here they are:
import java.awt.geom.Line2D;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Color;
/**
* Course... |
Forum: Java Jul 21st, 2008 |
| Replies: 22 Views: 2,313 I re-worked my code, and found a different approach to fixing this problem. The objects now need a Color as one of their parameters, so a color button is first clicked, then the shape.
For my... |
Forum: Java Jul 20th, 2008 |
| Replies: 26 Views: 3,897 Yeah, I think you're right. That is why I mentioned the arrays. Is there a simpler way to convert arraylists to an array? |
Forum: Java Jul 20th, 2008 |
| Replies: 26 Views: 3,897 I need to write a program that draws the next iteration if a koch snowflake, when a button is clicked. It begins with a equilateral triangle. The program uses an ArrayList, Polygon, and GeneralPath,... |
Forum: Java Jul 19th, 2008 |
| Replies: 22 Views: 2,313 I didn't post any updated code because I haven't yet made any significant changes. I want to remove the Graphic interface from the actionlistener embedded classes, so I can remove the draw method. I... |
Forum: Java Jul 19th, 2008 |
| Replies: 22 Views: 2,313 I've started to tinker with the paint method. No results really. I've been able to get initial drawings, but not update them with the buttons yet. |
Forum: Java Jul 16th, 2008 |
| Replies: 22 Views: 2,313 Write a simple graphics editor that allows users to add a mixture of shapes (ellipses, rectangles, and lines in different colors) to a panel. Supply commands to load and save the picture.
... |
Forum: Java Jul 16th, 2008 |
| Replies: 4 Views: 1,880 The instanceof and casting seems to be what I was looking for, thanks. |
Forum: Java Jul 13th, 2008 |
| Replies: 4 Views: 1,880 Is there a way that after you store something, such a Rectangle, to an object variable, say, Object x, that you can then look at object x, and determine it is indeed a rectangle, allowing you to use... |
Forum: Java Jul 7th, 2008 |
| Replies: 12 Views: 2,331 I solved my problem, partly. I had forgotten to close the writer, closing it gained me a write out. I still only get prompted for one input file however. |
Forum: Java Jul 4th, 2008 |
| Replies: 12 Views: 2,331 I emailed my professor concerning this problem. The method he suggested was to open the file of writing to, then write each file to it line by line. I believe I have a problem somewhere with either... |
Forum: Java Jul 2nd, 2008 |
| Replies: 12 Views: 2,331 So I would use a FileReader to open the file, construct a scanner from the filereader, and append what I take from that scanner?
I'm also unsure of how to proceed with the array testing in the... |
Forum: Java Jul 2nd, 2008 |
| Replies: 12 Views: 2,331 I'm having a problem when running the code. It gives me the initial prompt, but then it doesn't re-prompt after I input a file. Also, I'm not exactly how I should implement a buffer. Could I get a... |
Forum: Java Jul 1st, 2008 |
| Replies: 12 Views: 2,331 If using a StringBuilder, what kind of capacity should I have? I'm thinking I make the builder, then use insert methods to enter the files. Then I would pass the builder to my PrintWriter? |
Forum: Java Jul 1st, 2008 |
| Replies: 12 Views: 2,331 Some of this code was edited by me, but not much. Only the first if statement. My main problem its the String target line, and the for loop. I don't know what to do with them. I'm also not sure what... |
Forum: Java Jul 1st, 2008 |
| Replies: 12 Views: 2,331 Basically, I need to write a program that takes a user input for multiple text files, and then prints them out into one file.
I usually try not to pose questions here back to back, but alas, I... |
Forum: Java Jul 1st, 2008 |
| Replies: 15 Views: 2,150 I think i finally completed the code. It seems to be working correctly now. I'll post it below and if anyone could take a look and see if there are any further errors I would appreciate it. Thanks... |