User Tools

Site Tools


pex08

Programming Exercise 8

Here is a Java class implementing a linked list, and here is its API.

  • Modify the linked list so that it implements the Queue interface, with this API.
  • Write a graphical user interface (GUI) for any class implementing the Queue<String> interface. The GUI should look roughly like the figure below (it doesn't matter if it looks exactly like that, so long as all the components are there). On the top row, from left to right, we have a JTextField and two buttons – when the “enter” button is clicked, the text in the JTextField is entered into the queue. On the second row, we have a JTextField – when the “exit” button is clicked, this JTextField displays the string that exits the queue; however, if the queue is empty when “exit” is clicked, then this field displays “(empty)”.
  • NOTE 1: This window uses a flow layout, so whether or not the components appear on different rows is not important.
  • NOTE 2: The second JTextField should not be editable. You can use setEditable(false).
  • NOTE 3: You don't have to use the model-view-controller pattern if you don't want to.

pex08.txt · Last modified: 2010/04/01 16:43 by aeckford

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki