| ||||||||||
As Jim said. Mark Guzdial |
for (int i=1; i <= count; i++) { copy = nextOne.copyNode(); // Make a copy //Skip skipAmount nodes skipped = 1; while ((current.getNext() != null) && (skipped < skipAmount)) { current = current.getNext(); skipped++; }; if (current.getNext() == null) // Did we actually get to the end early? break; // Leave the loop oldNext = current.getNext(); // Save its next current.insertAfter(copy); // Insert the copy after this one current = oldNext; // Continue on with the rest } }
I'll try to catch up on all of these at once.
|
I think that that's the cleanest – one input for repeat, two inputs for weave, for a total of three. Maybe like the below: Mark Guzdial |
Sounds great! How about using a JLabel like we've used several times now? Mark Guzdial |
I see Jim already got to this one...:-) Mark Guzdial |
That's because it's not there. If you want to go beyond the UI stuff we showed, you'll have to look it up. Fortunately, there are tons of good examples and tutorials on the Web, e.g. http://java.sun.com/docs/books/tutorial/uiswing/layout/grid.html Mark Guzdial |
I don't see why you can't add it to the ActionListener. Mark Guzdial |
Y'know a really easy and useful (and easy to implement) button to have would be "Clear". Just thinkin' out loud here... Mark Guzdial |
Uh, why would pack() on the JFrame effect the linked list at all? Mark Guzdial |
Yes, I will have office hours tomorrow 2-3, and you're welcome to bring your problem to class. (Even send me code via email.) Yes, of course, the empty sound at the front is being counted – why wouldn't it? Think about it: How might you avoid that? (Hint: root.getNext().weave(...)) Mark Guzdial |
Write is a class, so it has to be capitalized. And to access them, you'll have to do all the JMusic imports. Mark Guzdial |