DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005

    Read a file into an array:) but how do i get it to populate a selection box in JFrame

    I have been working on reading a file and storing the contents into an array. However, as i have spent a bit of time doing this, i have come to a big problem how can i use it? I ideally want it to be read by an arraylist in another class ( Which is a class that creates the JFrame and its components) and be viewable and 'selectable' to the user via a selection box. Therefore when the file is read by the program the selection box is populated with values contained in the file read, which can then be selected.

    My problem is the middle bit, how can/does it read from the array to the arraylist and then be displayed? I have coding ATM that all i do is change the string value names in the arraylist so that when you run the progam the selection box contains values, which i change to any name i want.

    Please help

  2. #2
    Join Date
    Nov 2004

    Here is a setup.

    This is a JList extension that I have been using for years. I have packed
    it with a JFrame for demonstration, that reads objects into an arrayList and
    displays it in the selectable JList extension.
    Attached Files Attached Files
    eschew obfuscation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.