Need help with array and input
hi, I'm new to the forum and they have been of help to me before. This is my first semester of taking computer science and I'm having trouble on my 2nd to last homework assignment of the semester (its due tonight at midnight). Here are the details http://moosehead.cis.umassd.edu/cis1...k/hw5/hw5.html and here is what I have so far
what I'm having most trouble with is getting input from user and putting it into the arrays and the StringTokenizer stuff. I think I can figure out the actual sorting of the arrays once I get the other things finished first.
public class InputSort extends Applet implements ActionListener
private Label prompt; // The GUI components
private TextArea numbers;
private TextArea sortedNumbers;
private Button up,down,clear;
private int array;
public void init()
prompt = new Label("Enter a Whole Number");
numbers = new TextArea(5,40);
sortedNumbers = new TextArea(5,40);
up = new Button("Up");
down = new Button("Down");
clear = new Button("Clear");
} // init()
private void doUp()
// ascending sorting
private void doDown()
// descending sorting
public void actionPerformed(ActionEvent e)
if(e.getSource() == clear)
else if (e.getSource() == up)
else if (e.getSource() == down)
Any help is appreciated, and if possible be plain and simple in your explanations because I'm still sort of new at this stuff.
Thanks in advance.
Last edited by hodgenpodg; 11-28-2005 at 07:21 PM.
So ... you are prompting your user to type a number in the TextArea ... and you need to use that text.
what kind of Event can be generated by a TextArea? If the events generated by TextArea are not of the kind that is useful, what component can you add which will generate a more easily used event?
what kind of listener do you need to catch that Event?
when you have the correct event triggered, what do you need to do with the text captured from the TextArea?
Good luck in your efforts!
not exactly the user has to be able to enter multiple integers into the textarea and I don't know how many nor can I ask before hand.
then perhaps you should have a "Accept Input" button which fires an event which takes the text in the TextArea and processes the various ints which can be extracted from the text ...
By geophysicist in forum VB Classic
Last Post: 10-23-2005, 10:15 AM
By Wizard1988 in forum Java
Last Post: 10-13-2005, 07:26 PM
By kanakatam in forum Java
Last Post: 04-15-2005, 10:06 PM
By N. Richards in forum VB Classic
Last Post: 09-09-2000, 06:50 PM
Last Post: 07-06-2000, 05:44 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center