Nebenbemerkung:
Du kannst dem JList Konstruktor einen Vector<String> übergeben, der angezeigt wird. Funktioniert stattdessen auch mit einem String[].
Probier mal einen minimalen Testcode:
Code:
...
public void createGUI() {
//Liste erstellen
String[] textArr = {"Test"};
list = new JList(textArr);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scrolli = new JScrollPane(list);
scrolli.setPreferredSize(new Dimension(350,150));
pane.add(scrolli);
frame.add(pane);
frame.setTitle("Telefonbuch Verwaltung");
frame.setPreferredSize(new Dimension(360,265));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
____________________________________
Join the DNRC |
Godwin\'s Law (thx@stona)
Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing.
\"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra)