Results 1 to 5 of 5
  1. #1
    viewer is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default hello first.....

    then i am trying to develope application smiliar "windows explorer" with netbean....
    i have one file array (.listfiles) and one string array(.files)...geting from same directory.....
    i want to separete string array two part with usuing file array.....
    one is visible files...second is subdirectories....
    subdirectories will be item of treebox.....visible files will be item of listbox....
    my problem is enlarge these files and sundirectores arrays on runtime...and adding new value to them....

    best regards

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    You cannot increase the size (length) of an arrays dynamically, a string array for example. So what we could do? Read about collections in Java.

    Lesson: Interfaces (The Java™ Tutorials > Collections)

    There are some tricky ways to do dynamic sizes handling in Java, bit not safe at all. So I suggest you not to go for such things.

  3. #3
    viewer is offline Member
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Default

    i am trying ...
    to copy existing array to new create temp array.....
    create first array again with one more length.....
    copy back array from temp to enlarged array....

    but this is not work exactly.....
    any one know more easy solution of tthis.....

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by viewer View Post
    to copy existing array to new create temp array.....
    create first array again with one more length.....
    copy back array from temp to enlarged array....
    That's what I've told you. Changing the size of an array dynamically it problematic. That's why different implementations introduced in Java. Did you go through the like I've send to you?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •