• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Canonical construction of JList from FIle.

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic