Sie sind auf Seite 1von 2

package test;

import java.awt.*;
import java.util.LinkedList;
import java.util.StringTokenizer;
import javax.swing.*;

public class LinkList {


private static JComboBox<String> cbo;
static LinkedList<String> LL = new LinkedList<String>();

public static void main(String[] args) {

int i;

do {
String choices[] = {"Add","Clone","Add All",
"Add First", "Add Last",
"Delete All", "Remove"};
cbo = new JComboBox<String>(choices);
i = JOptionPane.showConfirmDialog(null,
new Object[] {"read all elements",
new JTextField (LL+""),"make a choice",cbo},
"link List", JOptionPane.OK_CANCEL_OPTION);
if (i==JOptionPane.OK_OPTION){
switch(cbo.getSelectedItem()+""){
case "Add":
LL.add(JOptionPane.showInputDialog(
"Add element in the Linked List"));
break;
case "Clone":
LinkedList<String> copy =
(LinkedList<String>) LL.clone();
JOptionPane.showMessageDialog(null, new Object[]
{"Clone created", new
JTextArea(""+copy)});
break;
case "Add All":

break;
case "Add First":

break;
case "Add Last":

break;
case "Delete All":

break;
case "Remove":

break;
case "Exit":

break;
}
}

}while(true);

Das könnte Ihnen auch gefallen