• Post Reply Bookmark Topic Watch Topic
  • New Topic

Canonical construction of JList from FIle.  RSS feed

Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing my GUI.

I have decided - until I get further along in concepting the GUI - to place several JLists in a BorderLayout and am hardcoding these as String[]for the moment while I get-going:

I need to know the canonical way to get these (where I have used a string array) read into a JList or other visible list from a file. For now, these will be one word per line trimmed and formatted and so on to accomodate clean code while I am concepting the GUI, I will address complexities such as parsing a line and whatever else I find necessary after I get the GUI working, I have most of these problems worked out already in the data Model that has already neared completetion. The usual sample code is:
listModel = new DefaultListModel();
listModel.addElement("Debbie Scott");
listModel.addElement("Scott Hommel");
listModel.addElement("Alan Sommerer");

Which does not lend it's self to my immediate goals. I would like for critics to drag me over the coals on this one as this is a design decision that will bear on the performance of Alpha 0.4 ver.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!