This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Java Scrolling Applet Using Arrays  Help please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Scrolling Applet Using Arrays  Help please" Watch "Java Scrolling Applet Using Arrays  Help please" New topic

Java Scrolling Applet Using Arrays Help please

Ben Peer

Joined: Apr 21, 2010
Posts: 15
For my computer science course we have to incorperate an array into an applet to make five line scroll in a certain order. i have started but have no idea where to go from there. would really appreciate help.

and this is my html file

any ideas would be great
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11814

Well, I'd say from here, you need to make the lines scroll in a certain order.

In all seriousness, you'll find you get better help if you ask a more specific question. What EXACTLY are you stuck on?

putting them into an array?
displaying them?
displaying them in a specific order?
getting them to scroll?
compiling your code?

Each of these questions would have to go down a different road, and may lead to more questions. Without knowing where you are really stuck, most people aren't going to bother helping you since they would probably just be wasting their time answering the 'wrong' question.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42956
The array requirement might be satisfied by having something like this:

The scrolling part could be addresses by having 5 threads that scroll each line independently of all other lines (assuming that you have covered multi-threading; if not, that part could also work sequentially).
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11814

Ulf, it sounds like you are thinking that each line should scroll across.

I interpreted the assignment as the 5 lines should scroll like on an ancient terminal - i.e. a new line scrolls up, replacing the previous one.

Which, again, is why we need more specific guidelines from the OP.
Ben Peer

Joined: Apr 21, 2010
Posts: 15
This is what's required

Use arrays to create an applet that lists five of your favorite songs. The applet should:
• scroll the list of song titles, one at a time
• each song title should start at the top of the applet and scroll to the middle then, scroll off the right hand side
• each new song title should scroll in a different colour
• the applet should loop, that is, when it gets to the end of the list, start over again at the beginning of the list
*The last step is the most difficult one. This step is not a matter of Java "know-how" but, a matter of being able to reason through the problem of "how to get text to change direction when it hits a certain point on the applet?"

and as for where im stuck is every where i dont know where to start as for what i have i dont even know how i got there..
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11814

Does what you have compile/do you know how to compile it? Does it run/do you know how to run it?

Does any of what you (allegedly) have written make any sense?

The best way to program is to break things down into TEENY TINY steps. Do one step, get it working, and only then move on.

Nobody here is going to write the code for you. We are happy to HELP you, but you have to do the work. Start by telling us what you know, and exactly where you are, and what you're trying to do next.

Simply saying "It doesn't work. I don't know what to do" is not going to get you any help at all around here.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 43350
Try scrolling everything, but forget the colours and things. Make it simple, then (to add to what Fred says) it will be easier, and you can add other features and enhancements later.

You realise there are classes usually used in applets which support scrolling automatically?
Aldoria Robichaud

Joined: Jun 01, 2010
Posts: 5
Hey, I think I must be in the same online course as Ben Peer. I am on the same assignment.
Just to let you guys know, what we learn in our Content is always completely different than the assignments they ask us to do, thats why its so hard.

Anyways, I have no idea where I'm even going to start with this assignment, but.. I'm sure I will need help and this seems like the appropriate thread, so when I do guess I'll post here :p

I'm not the brightest light bulb. I'm not the sharpest tool in the drawer. I'm not the smartest student in the classroom. I couldn't cut the pickle. But hey, at least I try, right? Or is that a bad thing..
jQuery in Action, 3rd edition
subject: Java Scrolling Applet Using Arrays Help please
It's not a secret anymore!