Forum: Java May 6th, 2009 |
| Replies: 12 Views: 519 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: 293 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: 268 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: 628 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: 759 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: 759 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,136 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,136 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: Networking Hardware Configuration Dec 31st, 2008 |
| Replies: 0 Views: 745 Hello, I'm not sure if all of this is even completely possible, but I'm sure some of you will be able to tell me.
What I want to do is set up a desktop pc running linux (Kubuntu 8.10 possibly, a... |
Forum: Java Nov 17th, 2008 |
| Replies: 3 Views: 633 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: 633 "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,747 Would recursion make this problem any easier? |
Forum: Java Aug 14th, 2008 |
| Replies: 26 Views: 3,747 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,747 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,747 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,747 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,747 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,747 Is this calculation different for each side? Like I was doing? |
Forum: Java Aug 13th, 2008 |
| Replies: 26 Views: 3,747 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,747 Ahh, that makes more sense. Thanks. |
Forum: Java Aug 12th, 2008 |
| Replies: 26 Views: 3,747 Your code here seems to use a class Point. Yes? |
Forum: Java Jul 22nd, 2008 |
| Replies: 26 Views: 3,747 Very. I can't for the life of me see why it does this. |
Forum: Java Jul 22nd, 2008 |
| Replies: 26 Views: 3,747 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,275 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,275 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,275 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,747 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,747 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,275 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,275 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,275 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,842 The instanceof and casting seems to be what I was looking for, thanks. |
Forum: Java Jul 13th, 2008 |
| Replies: 4 Views: 1,842 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,302 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,302 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,302 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,302 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,302 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,302 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,302 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... |