I am lost with these instructions(at the bottom) - I have the first part where I have instance variables which hold an array named "display" and initiated ao ALabels for output put I can't get any further. Here's what I have so far:
public class ListOfStrings extends A3ButtonHandler {
private A3ButtonWindow win; private ATextField input; private ALabel entries; private ALabel answer; private ALabel[] display; // Declares a variable that can hold an array
/** * Constructs the handler object, the 3-button * window and populates the window. */ public ListOfStrings() {
// Create the 3-button window win = new A3ButtonWindow(this); win.setLeftText("Save"); win.setMidText("Display"); win.setRightText("Discard");
display = new ALabel[10]; display[0] = new ALabel(200, 100, 200, 20); // Populate first element display[1] = new ALabel(200, 125, 200, 20); display[2] = new ALabel(200, 150, 200, 20); display[3] = new ALabel(200, 175, 200, 20); display[4] = new ALabel(200, 200, 200, 20); display[5] = new ALabel(200, 225, 200, 20); display[6] = new ALabel(200, 250, 200, 20); display[7] = new ALabel(200, 275, 200, 20); display[8] = new ALabel(200, 300, 200, 20); display[9] = new ALabel(200, 325, 200, 20); display[9] = new ALabel(200, 350, 200, 20); // Populate tenth element
input = new ATextField(125, 400, 150, 25); input.place(win);
// Refresh the window win.repaint(); }
Create storage for the list of phrases. The core of this program maintains a list of string values that are input by the user. In this step, you will create the storage for the list. This consists of two parts: an array that can contain up to 10 String objects and an integer that will show how many objects in the array are in the list.
Declare instance variables for the list, that is, the array of Strings and the count of items in the list. Name them something descriptive, like storage and count. In the constructor, create the array and initialize the count to zero. There is no reason to fill the array. Since the count is zero, we know not to access values within the array. There is no visible change based on this step.