Beruflich Dokumente
Kultur Dokumente
import java.awt.*;
import java.util.LinkedList;
import java.util.StringTokenizer;
import javax.swing.*;
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);